[Kstars-devel] KDE/kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Fri Sep 28 08:05:16 CEST 2007


SVN commit 718081 by harris:

Find Dialog: Up/Down arrow keys traverse the list of objects.

CCMAIL: kstars-devel at kde.org



 M  +19 -1     finddialog.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/finddialog.cpp #718080:718081
@@ -196,6 +196,7 @@
     }
 
     init();
+    ui->SearchList->QWidget::setFocus();
 }
 
 void FindDialog::filterByName() {  //Filter the list of names with the string in the SearchBox
@@ -257,8 +258,25 @@
     case Qt::Key_Escape :
         reject();
         break;
-
+    case Qt::Key_Up :
+    {
+        int currentRow = ui->SearchList->currentIndex().row();
+        if ( currentRow > 0 ) {
+            QModelIndex selectItem = sortModel->index( currentRow-1, sortModel->filterKeyColumn(), QModelIndex() );
+            ui->SearchList->selectionModel()->select( selectItem, QItemSelectionModel::ClearAndSelect );
+        }
+        break;
     }
+    case Qt::Key_Down :
+    {
+        int currentRow = ui->SearchList->currentIndex().row();
+        if ( currentRow < sortModel->rowCount()-1 ) {
+            QModelIndex selectItem = sortModel->index( currentRow+1, sortModel->filterKeyColumn(), QModelIndex() );
+            ui->SearchList->selectionModel()->select( selectItem, QItemSelectionModel::ClearAndSelect );
+        }
+        break;
+    }
+    }
 }
 
 #include "finddialog.moc"


More information about the Kstars-devel mailing list