VirtualBox

Changeset 86651 in vbox for trunk/src


Ignore:
Timestamp:
Oct 20, 2020 2:33:08 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Chooser pane: Restore full set of selected items if possible while rebuilding the tree.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r86649 r86651  
    16581658void UIChooserModel::buildTreeForMainRoot(bool fPreserveSelection /* = false */)
    16591659{
    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();
    16641665
    16651666    /* Cleanup previous tree if exists: */
     
    16771678    updateTreeForMainRoot();
    16781679
    1679     /* Restore selection if requested: */
     1680    /* Restore all selected items if requested: */
    16801681    if (fPreserveSelection)
    16811682    {
    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());
    16831692        makeSureAtLeastOneItemSelected();
    16841693    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette