VirtualBox

Ignore:
Timestamp:
Jan 30, 2019 6:12:57 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128506
Message:

FE/Qt: bugref:9241: VirtualBox Manager UI: Reworking Chooser-pane items hierarchy the way that they are really children of actual parent groups up to invisible root-group; this allows to manage z-order and visibility implicitly but requires a bit of magic for proper layout and animation handling.

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

Legend:

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

    r76920 r77061  
    195195UIChooserItem::UIChooserItem(UIChooserItem *pParent, bool fTemporary,
    196196                             int iDefaultValue /* = 100 */, int iHoveredValue /* = 90 */)
    197     : m_pParent(pParent)
     197    : QIWithRetranslateUI4<QIGraphicsWidget>(pParent)
     198    , m_pParent(pParent)
    198199    , m_fTemporary(fTemporary)
    199200    , m_fRoot(!pParent)
     
    345346}
    346347
    347 void UIChooserItem::show()
    348 {
    349     /* Call to base-class: */
    350     QIGraphicsWidget::show();
    351 }
    352 
    353 void UIChooserItem::hide()
    354 {
    355     /* Call to base-class: */
    356     QIGraphicsWidget::hide();
    357 }
    358 
    359348void UIChooserItem::setRoot(bool fRoot)
    360349{
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.h

    r76920 r77061  
    134134        /** Defines a @a iLevel of item. */
    135135        void setLevel(int iLevel);
    136 
    137         /** Shows item. */
    138         virtual void show();
    139         /** Hides item. */
    140         virtual void hide();
    141136
    142137        /** Starts item editing. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.cpp

    r77042 r77061  
    391391    AssertPtrReturnVoid(parentItem());
    392392    parentItem()->addItem(this, m_iPosition);
    393     setZValue(parentItem()->zValue() + 1);
    394393
    395394    /* Configure connections: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp

    r77048 r77061  
    124124    AssertMsg(parentItem(), ("Incorrect parent passed!"));
    125125    parentItem()->addItem(this, iPosition);
    126     setZValue(parentItem()->zValue() + 1);
    127126    connect(this, &UIChooserItemGroup::sigToggleStarted,
    128127            model(), &UIChooserModel::sigToggleStarted);
     
    169168    AssertMsg(parentItem(), ("Incorrect parent passed!"));
    170169    parentItem()->addItem(this, iPosition);
    171     setZValue(parentItem()->zValue() + 1);
    172170    connect(this, &UIChooserItemGroup::sigToggleStarted,
    173171            model(), &UIChooserModel::sigToggleStarted);
     
    360358    /* Paint header: */
    361359    paintHeader(pPainter, rectangle);
    362 }
    363 
    364 void UIChooserItemGroup::show()
    365 {
    366     /* Call to base-class: */
    367     UIChooserItem::show();
    368     /* Show children: */
    369     if (!isClosed())
    370         foreach (UIChooserItem *pItem, items())
    371             pItem->show();
    372 }
    373 
    374 void UIChooserItemGroup::hide()
    375 {
    376     /* Call to base-class: */
    377     UIChooserItem::hide();
    378     /* Hide children: */
    379     foreach (UIChooserItem *pItem, items())
    380         pItem->hide();
    381360}
    382361
     
    513492            else
    514493                m_groupItems.insert(iPosition, pItem);
    515             scene()->addItem(pItem);
    516494            break;
    517495        }
     
    523501            else
    524502                m_globalItems.insert(iPosition, pItem);
    525             scene()->addItem(pItem);
    526503            break;
    527504        }
     
    533510            else
    534511                m_machineItems.insert(iPosition, pItem);
    535             scene()->addItem(pItem);
    536512            break;
    537513        }
     
    557533        {
    558534            AssertMsg(m_groupItems.contains(pItem), ("Group-item was not found!"));
    559             scene()->removeItem(pItem);
    560535            m_groupItems.removeAt(m_groupItems.indexOf(pItem));
    561536            break;
     
    564539        {
    565540            AssertMsg(m_globalItems.contains(pItem), ("Global-item was not found!"));
    566             scene()->removeItem(pItem);
    567541            m_globalItems.removeAt(m_globalItems.indexOf(pItem));
    568542            break;
     
    571545        {
    572546            AssertMsg(m_machineItems.contains(pItem), ("Machine-item was not found!"));
    573             scene()->removeItem(pItem);
    574547            m_machineItems.removeAt(m_machineItems.indexOf(pItem));
    575548            break;
     
    845818        const int iChildrenSpacing = data(GroupItemData_ChildrenSpacing).toInt();
    846819        QRect geo = geometry().toRect();
    847         int iX = geo.x();
    848         int iY = geo.y();
     820        int iX = 0;
     821        int iY = 0;
    849822        int iWidth = geo.width();
    850823
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.h

    r76581 r77061  
    122122        /** Returns RTTI item type. */
    123123        virtual int type() const /* override */ { return Type; }
    124 
    125         /** Shows item. */
    126         virtual void show() /* override */;
    127         /** Hides item. */
    128         virtual void hide() /* override */;
    129124
    130125        /** Starts item editing. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp

    r77041 r77061  
    592592    AssertPtrReturnVoid(parentItem());
    593593    parentItem()->addItem(this, m_iPosition);
    594     setZValue(parentItem()->zValue() + 1);
    595594
    596595    /* Configure connections: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r77051 r77061  
    484484    m_pAfterSlidingFocus = root()->items().first();
    485485
     486    /* Hiding new root: */
     487    root()->hide();
     488
     489    /* Move it to scene (making it top-level item): */
     490    root()->setParentItem(0);
     491    scene()->addItem(root());
     492
    486493    /* Slide root: */
    487494    slideRoot(true);
     
    500507    /* Hiding old root: */
    501508    root()->hide();
     509
     510    /* Remove it from scene (returning back to it's parent): */
     511    root()->setParentItem(root()->parentItem());
    502512
    503513    /* Create left root: */
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