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

List:       kde-commits
Subject:    KDE/kdepim/kaddressbook/xxport
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2008-08-25 14:42:20
Message-ID: 1219675340.881023.4242.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 852215 by tokoe:

Let the comboboxes in header view follow scrolling


 M  +12 -2     comboboxheaderview.cpp  
 M  +3 -0      comboboxheaderview.h  
 M  +4 -0      csvimportdialog.cpp  


--- trunk/KDE/kdepim/kaddressbook/xxport/comboboxheaderview.cpp #852214:852215
@@ -57,7 +57,8 @@
       mComboBox( 0 ),
       mCurrentIndex( -1 ),
       mHoverStyle( true ),
-      mMargin( 1 ) {}
+      mMargin( 1 ),
+      mScrollOffset( 0 ) {}
 
     QStringList mItems;
 
@@ -68,6 +69,7 @@
 
     bool mHoverStyle;
     int mMargin;
+    int mScrollOffset;
 };
 //@endcond
 
@@ -202,12 +204,20 @@
         box = d->mBoxes[ i ];
       }
 
-      box->setGeometry( sectionRect( i ) );
+      QRect rect = sectionRect( i );
+      rect.moveLeft( rect.x() + d->mScrollOffset );
+      box->setGeometry( rect );
       box->setVisible( true );
     }
   }
 }
 
+void ComboBoxHeaderView::adaptMove( int shift )
+{
+  d->mScrollOffset = -shift;
+  initialize();
+}
+
 void ComboBoxHeaderView::slotActivated( const QString &text )
 {
   // FIXME a solution with QAbstractItemModel::setHeaderData
--- trunk/KDE/kdepim/kaddressbook/xxport/comboboxheaderview.h #852214:852215
@@ -50,6 +50,9 @@
     int indexOfHeaderLabel( int logicalIndex ) const;
     QString valueOfHeaderLabel( int logicalIndex ) const;
 
+  public Q_SLOTS:
+    void adaptMove( int );
+
   private:
     inline QRect sectionRect( int logicalIndex ) const;
     inline void adjustComboBoxIndex( QComboBox *comboBox, int logicalIndex );
--- trunk/KDE/kdepim/kaddressbook/xxport/csvimportdialog.cpp #852214:852215
@@ -32,6 +32,7 @@
 #include <QtGui/QLineEdit>
 #include <QtGui/QPushButton>
 #include <QtGui/QRadioButton>
+#include <QtGui/QScrollBar>
 #include <QtGui/QTableWidget>
 
 #include <kprogressdialog.h>
@@ -472,6 +473,9 @@
   enableButton( User1, false );
   enableButton( User2, false );
 
+  connect( mTable->horizontalScrollBar(), SIGNAL( valueChanged( int ) ),
+           static_cast<ComboBoxHeaderView*>( mTable->horizontalHeader() ), SLOT( adaptMove( int ) ) );
+
   resize( 400, 300 );
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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