summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Rossi <pierre.rossi@nokia.com>2009-11-19 17:34:43 (GMT)
committerPierre Rossi <pierre.rossi@nokia.com>2009-11-23 14:50:48 (GMT)
commit44bea4d915ccfcb43b5392b4b915b9cb40f59faa (patch)
tree91f4e536c7e59b503854e693d6b77eb6428104b9
parent4cfc3a884835667fe8c3a6aa745dc4ace34794e4 (diff)
downloadQt-44bea4d915ccfcb43b5392b4b915b9cb40f59faa.zip
Qt-44bea4d915ccfcb43b5392b4b915b9cb40f59faa.tar.gz
Qt-44bea4d915ccfcb43b5392b4b915b9cb40f59faa.tar.bz2
A few tweaks to the frozen column example
Reviewed-By: Thierry
-rw-r--r--examples/itemviews/frozencolumn/freezetablewidget.cpp9
-rw-r--r--examples/itemviews/frozencolumn/freezetablewidget.h1
-rw-r--r--examples/itemviews/frozencolumn/grades.txt3
3 files changed, 11 insertions, 2 deletions
diff --git a/examples/itemviews/frozencolumn/freezetablewidget.cpp b/examples/itemviews/frozencolumn/freezetablewidget.cpp
index ee50ae1..72dc2a1 100644
--- a/examples/itemviews/frozencolumn/freezetablewidget.cpp
+++ b/examples/itemviews/frozencolumn/freezetablewidget.cpp
@@ -84,7 +84,8 @@ void FreezeTableWidget::init()
//! [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 @@ QModelIndex FreezeTableWidget::moveCursor(CursorAction cursorAction,
}
//! [navigate]
+void FreezeTableWidget::scrollTo (const QModelIndex & index, ScrollHint hint){
+ if(index.column()>0)
+ QTableView::scrollTo(index, hint);
+}
+
+
//! [geometry]
void FreezeTableWidget::updateFrozenTableGeometry()
diff --git a/examples/itemviews/frozencolumn/freezetablewidget.h b/examples/itemviews/frozencolumn/freezetablewidget.h
index 403890f..d236d40 100644
--- a/examples/itemviews/frozencolumn/freezetablewidget.h
+++ b/examples/itemviews/frozencolumn/freezetablewidget.h
@@ -56,6 +56,7 @@ public:
protected:
virtual void resizeEvent(QResizeEvent *event);
virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers);
+ void scrollTo (const QModelIndex & index, ScrollHint hint = EnsureVisible);
private:
QTableView *frozenTableView;
diff --git a/examples/itemviews/frozencolumn/grades.txt b/examples/itemviews/frozencolumn/grades.txt
index 4b55b473..e1c6fcc 100644
--- a/examples/itemviews/frozencolumn/grades.txt
+++ b/examples/itemviews/frozencolumn/grades.txt
@@ -32,4 +32,5 @@
9a+ , , 5.15a , , , XI+ , , , , 12a
9b , , 5.15b , , , , , , , 12b
-# Wikipedia contributors. Grade (climbing). Wikipedia, The Free Encyclopedia. May 15, 2009, 20:42 UTC. Available at: http://en.wikipedia.org/w/index.php?title=Grade_(climbing)&oldid=290165724. Accessed May 28, 2009.
+# Wikipedia contributors. Grade (climbing). Wikipedia, The Free Encyclopedia. May 15, 2009, 20:42 UTC.
+# Available at: http://en.wikipedia.org/w/index.php?title=Grade_(climbing)&oldid=290165724. Accessed May 28, 2009.