OSSP CVS Repository

ossp - Difference in ossp-pkg/as/as-gui/as_table.cpp versions 1.4 and 1.5
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/as/as-gui/as_table.cpp 1.4 -> 1.5

--- as_table.cpp 2002/12/02 13:25:36     1.4
+++ as_table.cpp 2002/12/03 17:05:11     1.5
@@ -37,8 +37,29 @@
 // Implements an event filter for catching header double click events
 bool TiTable::eventFilter(QObject *pObject, QEvent *pEvent)
 {
-    if (pObject == horizontalHeader())
-        return false;
-    else
-        return QTable::eventFilter(pObject, pEvent);    // Pass the event onwards
+    if (pObject == horizontalHeader() && pEvent->type() == QEvent::MouseButtonDblClick)
+        return true;
+    else if (pEvent->type() == QEvent::KeyPress) {
+        if (((QKeyEvent *)pEvent)->key() == Qt::Key_Tab) {          // Handle tab key
+            if (this->getEdition() >= 0) {
+                int nColadvance = ((currentColumn() + 1) % TITRAQ_IDXEND);
+                if (nColadvance == 0)   // Advance the column and possibly the row too
+                    this->setCurrentCell(currentRow() + 1, nColadvance);
+                else
+                    this->setCurrentCell(currentRow(), nColadvance);
+                this->setReadOnly(false);
+                this->editCell(currentRow(), currentColumn());
+                this->setEdition(currentColumn());
+                this->setReadOnly(true);
+            }
+            return true;    // Handled the tab key event and cancel its progress
+        }
+        else if (((QKeyEvent *)pEvent)->key() == Qt::Key_Escape)    // Handle escape key
+            this->setEdition();
+
+        // Forward incompletely handled key events
+        return QTable::eventFilter(pObject, pEvent);
+    }
+    else                    // Default behaviour is to pass the event onwards
+        return QTable::eventFilter(pObject, pEvent);
 }

CVSTrac 2.0.1