kdelibs/kdeui/paged

Sebastian Sauer mail at dipe.org
Tue Nov 20 16:18:04 GMT 2007


Hi *

atm it is not possible to disable aka hide the header within a 
KPageView/KPageWidget if the faceType != Tabbed. Following both patches to 
fix this;

1. the header uses the name if QString::null and if "" the header does not got 
displayed. While this seems ugly it should provide the less offensive way to 
fix it since places where it's used atm without defining the header will 
still work as before and only an explicit setHeader("") does disable aka hide 
the header.

Index: kpageview.cpp
===================================================================
--- kpageview.cpp       (revision 736773)
+++ kpageview.cpp       (working copy)
@@ -226,7 +226,7 @@
 {
     Q_Q(KPageView);
     QString header = model->data( index, KPageModel::HeaderRole ).toString();
-    if ( header.isEmpty() ) {
+    if ( header.isNull() ) {
         header = model->data( index, Qt::DisplayRole ).toString();
     }

2. the alternate would be the following patch. Headers are just never 
displayed since setHeader() is explicit called. This looks like the most 
correct (as in logical) solution but may break (as in the header does not got 
shown any longer while it was before) now for those apps that didn't defined 
the header explicit.

Index: kpageview.cpp
===================================================================
--- kpageview.cpp       (revision 736773)
+++ kpageview.cpp       (working copy)
@@ -226,10 +226,6 @@
 {
     Q_Q(KPageView);
     QString header = model->data( index, KPageModel::HeaderRole ).toString();
-    if ( header.isEmpty() ) {
-        header = model->data( index, Qt::DisplayRole ).toString();
-    }
-
     titleWidget->setText( header.remove( '&' ) );

     const QIcon icon = model->data( index, 
Qt::DecorationRole ).value<QIcon>();

if ok, I would commit solution 2) else solution 1) or xyz?




More information about the kde-core-devel mailing list