$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r76081 - sandbox/icl/libs/xplore/br1/sqlbrowser
From: afojgo_at_[hidden]
Date: 2011-12-20 11:44:49
Author: jofaber
Date: 2011-12-20 11:44:48 EST (Tue, 20 Dec 2011)
New Revision: 76081
URL: http://svn.boost.org/trac/boost/changeset/76081
Log:
More qt exploration on selections.
Binary files modified: 
   sandbox/icl/libs/xplore/br1/sqlbrowser/media1.db
Text files modified: 
   sandbox/icl/libs/xplore/br1/sqlbrowser/browser.cpp |    41 ++++++++++++++++++++++++++++----------- 
   sandbox/icl/libs/xplore/br1/sqlbrowser/browser.h   |     4 ++                                      
   2 files changed, 32 insertions(+), 13 deletions(-)
Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/browser.cpp
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/browser.cpp	(original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/browser.cpp	2011-12-20 11:44:48 EST (Tue, 20 Dec 2011)
@@ -201,8 +201,8 @@
     table->resizeColumnsToContents();
     //JOFA additions ----------------------------------------------------------
 
-    //connect(table->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(currentChanged()));
-    connect(table->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(currentChanged2()));
+    //REV connect(table->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(currentChanged()));
+    connect(table->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), this, SLOT(on_rowSelectChanged()));
 
     updateActions();
 }
@@ -281,7 +281,7 @@
 
 void Browser::updateActions()
 {
-    emit statusMessage(tr("udateActions()"));
+    //CL emit statusMessage(tr("updateActions()"));
     bool enableIns = qobject_cast<QSqlTableModel *>(table->model());
     bool enableDel = enableIns && table->currentIndex().isValid();
 
@@ -289,15 +289,6 @@
     deleteRowAction->setEnabled(enableDel);
 }
 
-void Browser::updateActions2()
-{
-    QModelIndexList currentSelection = table->selectionModel()->selectedIndexes();
-    int selCount = currentSelection.count();
-    int firstRow = selCount > 0 ? currentSelection.at(1).row() : 0;
-
-    emit statusMessage(QString("Row %1 of %2 selected").arg(firstRow).arg(selCount));
-}
-
 void Browser::about()
 {
     QMessageBox::about(this, tr("About"), tr("The SQL Browser demonstration "
@@ -306,3 +297,29 @@
 }
 
 
+//JOFA TMP some checks
+
+void Browser::on_cellClicked(int row, int col)
+{
+    QString clickedCellInfo = QString("Row %1 Col %2 selected").arg(row).arg(col);
+    emit statusMessage(clickedCellInfo);
+}
+
+void Browser::on_rowSelectChanged()
+{
+    QModelIndexList currentSelection = table->selectionModel()->selectedIndexes();
+    int selCount    = currentSelection.count();
+    int firstRow    = selCount > 0 ? currentSelection.at(1).row() : -1;
+    int firstColumn = selCount > 0 ? currentSelection.at(1).column() : -1;
+
+    // Alway the last selection is found, not the current one.
+    QString selectedRowInfo = QString("Row %1 of %2 selected").arg(firstRow).arg(selCount);
+    emit statusMessage(selectedRowInfo);
+
+    int nextRow = firstRow + 1;
+    if     (firstRow > -1 && !table->isRowHidden(nextRow))
+        table->hideRow(nextRow);
+    else if(firstRow > -1 &&  table->isRowHidden(nextRow))
+        table->showRow(nextRow);
+}
+
Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/browser.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/browser.h	(original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/browser.h	2011-12-20 11:44:48 EST (Tue, 20 Dec 2011)
@@ -74,7 +74,6 @@
     void addConnection();
     void openFile();
     void currentChanged() { updateActions(); }
-    void currentChanged2() { updateActions2(); }
     void about();
 
     void on_insertRowAction_triggered()
@@ -96,6 +95,9 @@
         sqlEdit->setFocus();
     }
 
+    //JOFA TMP some checks
+    void on_cellClicked(int row, int col);
+    void on_rowSelectChanged();
 
 signals:
     void statusMessage(const QString &message);
Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/media1.db
==============================================================================
Binary files. No diff available.