VirtualBox

Changeset 77041 in vbox


Ignore:
Timestamp:
Jan 30, 2019 12:48:39 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9241: VirtualBox Manager UI: Proper prepare/cleanup cascade for Chooser machine item (s.a. r128309).

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
Files:
2 edited

Legend:

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

    r76942 r77041  
    6060    , m_iMaximumSnapshotNameWidth(0)
    6161{
    62     /* Prepare: */
    6362    prepare();
    6463}
     
    8281    , m_iMaximumSnapshotNameWidth(0)
    8382{
    84     /* Prepare: */
    8583    prepare();
    8684}
     
    8886UIChooserItemMachine::~UIChooserItemMachine()
    8987{
    90     /* If that item is focused: */
    91     if (model()->focusItem() == this)
    92     {
    93         /* Unset the focus: */
    94         model()->setFocusItem(0);
    95     }
    96     /* If that item is in selection list: */
    97     if (model()->currentItems().contains(this))
    98     {
    99         /* Remove item from the selection list: */
    100         model()->removeFromCurrentItems(this);
    101     }
    102     /* If that item is in navigation list: */
    103     if (model()->navigationList().contains(this))
    104     {
    105         /* Remove item from the navigation list: */
    106         model()->removeFromNavigationList(this);
    107     }
    108 
    109     /* Remove item from the parent: */
    110     AssertMsg(parentItem(), ("No parent set for machine-item!"));
    111     parentItem()->removeItem(this);
     88    cleanup();
    11289}
    11390
     
    613590
    614591    /* Add item to the parent: */
    615     AssertMsg(parentItem(), ("No parent set for machine-item!"));
     592    AssertPtrReturnVoid(parentItem());
    616593    parentItem()->addItem(this, m_iPosition);
    617594    setZValue(parentItem()->zValue() + 1);
     
    634611    /* Apply language settings: */
    635612    retranslateUi();
     613}
     614
     615void UIChooserItemMachine::cleanup()
     616{
     617    /* If that item is focused: */
     618    if (model()->focusItem() == this)
     619    {
     620        /* Unset the focus: */
     621        model()->setFocusItem(0);
     622    }
     623    /* If that item is in selection list: */
     624    if (model()->currentItems().contains(this))
     625    {
     626        /* Remove item from the selection list: */
     627        model()->removeFromCurrentItems(this);
     628    }
     629    /* If that item is in navigation list: */
     630    if (model()->navigationList().contains(this))
     631    {
     632        /* Remove item from the navigation list: */
     633        model()->removeFromNavigationList(this);
     634    }
     635
     636    /* Remove item from the parent: */
     637    AssertPtrReturnVoid(parentItem());
     638    parentItem()->removeItem(this);
    636639}
    637640
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.h

    r76935 r77041  
    220220        /** Prepares all. */
    221221        void prepare();
     222        /** Cleanups all. */
     223        void cleanup();
    222224    /** @} */
    223225
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