examples/itemviews/frozencolumn/freezetablewidget.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
--- a/examples/itemviews/frozencolumn/freezetablewidget.cpp	Tue Jan 26 12:42:25 2010 +0200
+++ b/examples/itemviews/frozencolumn/freezetablewidget.cpp	Tue Feb 02 00:43:10 2010 +0200
@@ -52,10 +52,10 @@
       init();
 
       //connect the headers and scrollbars of both tableviews together
-      connect(horizontalHeader(),SIGNAL(sectionResized ( int ,int,int )), this,
-              SLOT(updateSectionWidth(int, int, int)));
-      connect(verticalHeader(),SIGNAL(sectionResized ( int ,int,int )), this,
-              SLOT(updateSectionHeight(int, int, int)));
+      connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)), this,
+              SLOT(updateSectionWidth(int,int,int)));
+      connect(verticalHeader(),SIGNAL(sectionResized(int,int,int)), this,
+              SLOT(updateSectionHeight(int,int,int)));
 
       connect(frozenTableView->verticalScrollBar(), SIGNAL(valueChanged(int)),
               verticalScrollBar(), SLOT(setValue(int)));
@@ -84,7 +84,8 @@
 
 //! [init part2]
       frozenTableView->setStyleSheet("QTableView { border: none;"
-                                     "background-color: #8EDE21;}"); //for demo purposes
+                                     "background-color: #8EDE21;"
+                                     "selection-background-color: #999}"); //for demo purposes
       frozenTableView->setSelectionModel(selectionModel());
       for(int col=1; col<model()->columnCount(); col++)
             frozenTableView->setColumnHidden(col, true);
@@ -146,6 +147,12 @@
 }
 //! [navigate]
 
+void FreezeTableWidget::scrollTo (const QModelIndex & index, ScrollHint hint){
+    if(index.column()>0)
+        QTableView::scrollTo(index, hint);
+}
+
+
 
 //! [geometry]
 void FreezeTableWidget::updateFrozenTableGeometry()