Changeset 84567 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 27, 2020 2:41:06 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
r84565 r84567 437 437 } 438 438 439 void UIChooserModel::makeSureNoItemWithCertainIdIsSelected(const QUuid &uId) 440 { 441 /* Look for all nodes with passed uId: */ 442 QList<UIChooserNode*> matchedNodes; 443 invisibleRoot()->searchForNodes(uId.toString(), 444 UIChooserItemSearchFlag_Machine | 445 UIChooserItemSearchFlag_ExactId, 446 matchedNodes); 447 448 /* Compose a set of items with passed uId: */ 449 QSet<UIChooserItem*> matchedItems; 450 foreach (UIChooserNode *pNode, matchedNodes) 451 if (pNode && pNode->item()) 452 matchedItems << pNode->item(); 453 454 /* If we have at least one of those items currently selected: */ 455 if (selectedItems().toSet().intersects(matchedItems)) 456 setSelectedItem(findClosestUnselectedItem()); 457 } 458 439 459 void UIChooserModel::setCurrentItem(UIChooserItem *pItem) 440 460 { … … 1049 1069 void UIChooserModel::sltLocalMachineRegistered(const QUuid &uId, const bool fRegistered) 1050 1070 { 1071 /* Make sure no item with passed uId is selected: */ 1072 if (!fRegistered) 1073 makeSureNoItemWithCertainIdIsSelected(uId); 1074 1051 1075 /* Call to base-class: */ 1052 1076 UIChooserAbstractModel::sltLocalMachineRegistered(uId, fRegistered); … … 1078 1102 const QUuid &uId, const bool fRegistered) 1079 1103 { 1104 /* Make sure no item with passed uId is selected: */ 1105 if (!fRegistered) 1106 makeSureNoItemWithCertainIdIsSelected(uId); 1107 1080 1108 /* Call to base-class: */ 1081 1109 UIChooserAbstractModel::sltCloudMachineRegistered(strProviderName, strProfileName, uId, fRegistered); … … 1598 1626 return; 1599 1627 1600 /* Change selection to some close by item: */1601 setSelectedItem(findClosestUnselectedItem());1602 1603 1628 /* For every selected machine: */ 1604 1629 foreach (CMachine comMachine, machines) … … 1653 1678 if (iResultCode == AlertButton_Cancel) 1654 1679 return; 1655 1656 /* Change selection to some close by item: */1657 setSelectedItem(findClosestUnselectedItem());1658 1680 1659 1681 /* For every selected machine: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h
r84542 r84567 180 180 /** Finds closest non-selected-item. */ 181 181 UIChooserItem *findClosestUnselectedItem() const; 182 /** Makes sure selection doesn't contain item with certain @a uId. */ 183 void makeSureNoItemWithCertainIdIsSelected(const QUuid &uId); 182 184 183 185 /** Defines current @a pItem. */
Note:
See TracChangeset
for help on using the changeset viewer.