Changeset 40196 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Feb 21, 2012 12:48:56 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 76361
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r39932 r40196 1037 1037 int iRow = m_pVMModel->rowById(pItem->id()); 1038 1038 m_pVMModel->removeItem(pItem); 1039 m_pVMListView->ensure SomeRowSelected(iRow);1039 m_pVMListView->ensureOneRowSelected(iRow); 1040 1040 } 1041 1041 /* item = 0 is ok (if we originated this event then the item -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMListView.cpp
r39238 r40196 406 406 } 407 407 408 void UIVMListView::ensureSomeRowSelected(int aRowHint) 409 { 410 UIVMItem *item = currentItem(); 411 if (!item) 412 { 413 aRowHint = qBound(0, aRowHint, model()->rowCount() - 1); 414 selectItemByRow(aRowHint); 415 item = currentItem(); 416 if (!item) 417 selectItemByRow(0); 408 void UIVMListView::ensureOneRowSelected(int aRowHint) 409 { 410 /* Calculate nearest index row: */ 411 aRowHint = qBound(0, aRowHint, model()->rowCount() - 1); 412 413 /* Get current selection: */ 414 QModelIndexList selectedIndexes = selectionModel()->selectedIndexes(); 415 416 /* If there are less/more selected items than necessary 417 * or other than hinted row is selected: */ 418 if (selectedIndexes.size() != 1 || selectedIndexes[0].row() != aRowHint) 419 { 420 /* Make sure that only necessary item is selected: */ 421 setCurrentIndex(model()->index(aRowHint, 0)); 422 selectionModel()->select(currentIndex(), QItemSelectionModel::Current | QItemSelectionModel::ClearAndSelect); 418 423 } 419 424 } -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMListView.h
r39238 r40196 98 98 void selectItemByRow(int row); 99 99 void selectItemById(const QString &aID); 100 void ensure SomeRowSelected(int aRowHint);100 void ensureOneRowSelected(int aRowHint); 101 101 UIVMItem* currentItem() const; 102 102 QList<UIVMItem*> currentItems() const;
Note:
See TracChangeset
for help on using the changeset viewer.