[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [patch] header visibility for KPageWidget in tabbed and plain mode
From:       Jarosław_Staniek <js () iidea ! pl>
Date:       2007-06-11 20:41:24
Message-ID: 200706112241.24244.js () iidea ! pl
[Download RAW message or body]

Hello,
Without the patch, header was visible in tabbed and plain mode.

After the fix:
http://kexi-project.org/pics/2.0/alpha1/kpagewidget/

OK?

-- 
regards / pozdrawiam, Jaroslaw Staniek
 Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
 Kexi & KOffice: http://www.kexi-project.org, http://www.koffice.org
 KDE3 & KDE4 Libraries for MS Windows: http://kdelibs.com, http://www.kde.org

["kdeui_paged.patch" (text/x-diff)]

Index: kdeui/paged/kpageview.cpp
===================================================================
--- kdeui/paged/kpageview.cpp	(revision 674122)
+++ kdeui/paged/kpageview.cpp	(working copy)
@@ -66,6 +66,8 @@
     {
     }
 
+    void updateTitleWidget(const QModelIndex& index);
+
     KPageView* parent;
 
     // data
@@ -266,16 +268,23 @@
     //d->stack->setCurrentWidget( d->emptyWidget );
   }
 
+  updateTitleWidget(index);
+
+  emit parent->currentPageChanged( index, previous );
+}
+
+void KPageView::Private::updateTitleWidget(const QModelIndex& index)
+{
+  if (!parent->showPageHeader())
+    return;
+
   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>();
   titleWidget->setPixmap(icon.pixmap(22, 22));
-
-  emit parent->currentPageChanged( index, previous );
 }
 
 void KPageView::Private::dataChanged( const QModelIndex&, const QModelIndex& )
@@ -291,14 +300,7 @@
   if ( !index.isValid() )
     return;
 
-  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>();
-  titleWidget->setPixmap(icon.pixmap(22, 22));
+  updateTitleWidget(index);
 }
 
 /**


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic