ossp-pkg/as/as-gui/as_table.cpp 1.11 -> 1.12
--- as_table.cpp 2002/12/13 18:06:10 1.11
+++ as_table.cpp 2002/12/13 18:55:09 1.12
@@ -46,10 +46,14 @@
else if (pEvent->type() == QEvent::KeyPress) {
if (((QKeyEvent *)pEvent)->key() == Qt::Key_Tab) { // Handle tab key
if (this->getEdition() >= 0) {
- int nIter = 0; // To skip invisible columns
- while (columnWidth((currentColumn() + ++nIter) % TITRAQ_IDXTAIL) <= 0); // Skip invisibles
+ int nIter = 1; // Logic to skip invisible or read only columns
+ while (columnWidth((currentColumn() + nIter) % TITRAQ_IDXTAIL) <= 0
+ || isColumnReadOnly((currentColumn() + nIter) % TITRAQ_IDXTAIL))
+ nIter++;
+
+ // Advance the column or both row and column possibly
int nColadvance = ((currentColumn() + nIter) % TITRAQ_IDXTAIL);
- if (nColadvance == 0) // Advance the column and possibly the row too
+ if ((currentColumn() + nIter) >= TITRAQ_IDXTAIL)
this->setCurrentCell(currentRow() + 1, nColadvance);
else
this->setCurrentCell(currentRow(), nColadvance);
@@ -58,14 +62,18 @@
this->setEdition(currentColumn());
this->setReadOnly(true);
}
- return true; // Handled the tab key event and cancel its progress
+ return true; // Handle the tab key event and cancel its progress
}
else if (((QKeyEvent *)pEvent)->key() == Qt::Key_Backtab) { // Handle shift tab key
if (this->getEdition() >= 0) {
- int nIter = 0; // To skip invisible columns
- while (columnWidth((currentColumn() - ++nIter) % TITRAQ_IDXTAIL) <= 0); // Skip invisibles
- int nColadvance = ((currentColumn() - nIter) % TITRAQ_IDXTAIL);
- if (nColadvance == 0) // Advance the column and possibly the row too
+ int nIter = 1; // Logic to skip invisible or read only columns
+ while (columnWidth((currentColumn() - nIter + TITRAQ_IDXTAIL) % TITRAQ_IDXTAIL) <= 0
+ || isColumnReadOnly((currentColumn() - nIter + TITRAQ_IDXTAIL) % TITRAQ_IDXTAIL))
+ nIter++;
+
+ // Advance the column or both row and column possibly
+ int nColadvance = (currentColumn() - nIter + TITRAQ_IDXTAIL) % TITRAQ_IDXTAIL;
+ if ((currentColumn() - nIter) < 0)
this->setCurrentCell(currentRow() - 1, nColadvance);
else
this->setCurrentCell(currentRow(), nColadvance);
@@ -74,7 +82,7 @@
this->setEdition(currentColumn());
this->setReadOnly(true);
}
- return true; // Handled the tab key event and cancel its progress
+ return true; // Handle the shift tab key event and cancel its progress
}
else if (((QKeyEvent *)pEvent)->key() == Qt::Key_Escape) // Handle escape key
this->setEdition();
|
|