VirtualBox

Changeset 92029 in vbox


Ignore:
Timestamp:
Oct 25, 2021 12:05:29 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
147838
Message:

FE/Qt: bugref:9996: UIChooserModel: When new VM is registered, we should try to preserve selection while updating the tree cause new VM isn't guaranteed to be present in the tree.

File:
1 edited

Legend:

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

    r91348 r92029  
    433433
    434434    /* If global item is currently chosen, selection should be invalidated: */
    435     if (firstSelectedItem()->type() == UIChooserNodeType_Global)
     435    if (firstSelectedItem() && firstSelectedItem()->type() == UIChooserNodeType_Global)
    436436        emit sigSelectionInvalidated();
    437437}
     
    11531153        {
    11541154            /* Rebuild tree for main root: */
    1155             buildTreeForMainRoot(false /* preserve selection */);
    1156             /* Select newly added item: */
    1157             setSelectedItem(root()->searchForItem(uMachineId.toString(),
    1158                                                   UIChooserItemSearchFlag_Machine |
    1159                                                   UIChooserItemSearchFlag_ExactId));
     1155            buildTreeForMainRoot(true /* preserve selection */);
     1156            /* Search for newly added item: */
     1157            UIChooserItem *pNewItem = root()->searchForItem(uMachineId.toString(),
     1158                                                            UIChooserItemSearchFlag_Machine |
     1159                                                            UIChooserItemSearchFlag_ExactId);
     1160            /* Select newly added item if any: */
     1161            if (pNewItem)
     1162                setSelectedItem(pNewItem);
    11601163        }
    11611164    }
Note: See TracChangeset for help on using the changeset viewer.

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