- Timestamp:
- Oct 20, 2020 2:33:08 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r86649 r86651 1658 1658 void UIChooserModel::buildTreeForMainRoot(bool fPreserveSelection /* = false */) 1659 1659 { 1660 /* Remember first selected item if requested: */ 1661 QString strSelectedItemDefinition; 1662 if (fPreserveSelection && firstSelectedItem()) 1663 strSelectedItemDefinition = firstSelectedItem()->definition(); 1660 /* Remember all selected items if requested: */ 1661 QStringList selectedItemDefinitions; 1662 if (fPreserveSelection && !selectedItems().isEmpty()) 1663 foreach (UIChooserItem *pSelectedItem, selectedItems()) 1664 selectedItemDefinitions << pSelectedItem->definition(); 1664 1665 1665 1666 /* Cleanup previous tree if exists: */ … … 1677 1678 updateTreeForMainRoot(); 1678 1679 1679 /* Restore selectionif requested: */1680 /* Restore all selected items if requested: */ 1680 1681 if (fPreserveSelection) 1681 1682 { 1682 setSelectedItem(strSelectedItemDefinition); 1683 QList<UIChooserItem*> selectedItems; 1684 foreach (const QString &strSelectedItemDefinition, selectedItemDefinitions) 1685 { 1686 UIChooserItem *pSelectedItem = searchItemByDefinition(strSelectedItemDefinition); 1687 if (pSelectedItem) 1688 selectedItems << pSelectedItem; 1689 } 1690 setSelectedItems(selectedItems); 1691 setCurrentItem(firstSelectedItem()); 1683 1692 makeSureAtLeastOneItemSelected(); 1684 1693 }
Note:
See TracChangeset
for help on using the changeset viewer.