Changeset 84624 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jun 1, 2020 3:12:33 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r84622 r84624 321 321 } 322 322 323 void UIChooserModel::makeSureAtLeastOneItemSelected()324 {325 /* If we have no item selected but at326 * least one item in the navigation list (global item): */327 if (!firstSelectedItem() && !navigationItems().isEmpty())328 {329 /* We are choosing it, selection became invalidated: */330 setSelectedItem(navigationItems().first());331 emit sigSelectionInvalidated();332 }333 }334 335 323 bool UIChooserModel::isGroupItemSelected() const 336 324 { … … 434 422 } 435 423 436 void UIChooserModel::makeSureNoItemWithCertainId IsSelected(const QUuid &uId)424 void UIChooserModel::makeSureNoItemWithCertainIdSelected(const QUuid &uId) 437 425 { 438 426 /* Look for all nodes with passed uId: */ … … 453 441 setSelectedItem(findClosestUnselectedItem()); 454 442 455 /* If global item was chosen, selection became invalidated: */443 /* If global item is currently chosen, selection should be invalidated: */ 456 444 if (firstSelectedItem()->type() == UIChooserNodeType_Global) 457 445 emit sigSelectionInvalidated(); 446 } 447 448 void UIChooserModel::makeSureAtLeastOneItemSelected() 449 { 450 /* If we have no item selected but 451 * at least one in the navigation list (global item): */ 452 if (!firstSelectedItem() && !navigationItems().isEmpty()) 453 { 454 /* We are choosing it, selection should be invalidated: */ 455 setSelectedItem(navigationItems().first()); 456 emit sigSelectionInvalidated(); 457 } 458 458 } 459 459 … … 1072 1072 void UIChooserModel::sltLocalMachineRegistered(const QUuid &uId, const bool fRegistered) 1073 1073 { 1074 /* Make sure no item with passed uId is selected: */1074 /* Existing VM unregistered => make sure no item with passed uId is selected: */ 1075 1075 if (!fRegistered) 1076 makeSureNoItemWithCertainId IsSelected(uId);1076 makeSureNoItemWithCertainIdSelected(uId); 1077 1077 1078 1078 /* Call to base-class: */ … … 1104 1104 const QUuid &uId, const bool fRegistered) 1105 1105 { 1106 /* Make sure no item with passed uId is selected: */1106 /* Existing VM unregistered => make sure no item with passed uId is selected: */ 1107 1107 if (!fRegistered) 1108 makeSureNoItemWithCertainId IsSelected(uId);1108 makeSureNoItemWithCertainIdSelected(uId); 1109 1109 1110 1110 /* Call to base-class: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h
r84592 r84624 154 154 QList<UIVirtualMachineItem*> selectedMachineItems() const; 155 155 156 /** Makes sure at least one item selected. */157 void makeSureAtLeastOneItemSelected();158 159 156 /** Returns whether group item is selected. */ 160 157 bool isGroupItemSelected() const; … … 179 176 UIChooserItem *findClosestUnselectedItem() const; 180 177 /** Makes sure selection doesn't contain item with certain @a uId. */ 181 void makeSureNoItemWithCertainIdIsSelected(const QUuid &uId); 178 void makeSureNoItemWithCertainIdSelected(const QUuid &uId); 179 /** Makes sure at least one item selected. */ 180 void makeSureAtLeastOneItemSelected(); 182 181 183 182 /** Defines current @a pItem. */
Note:
See TracChangeset
for help on using the changeset viewer.