VirtualBox

Changeset 43954 in vbox


Ignore:
Timestamp:
Nov 26, 2012 7:47:25 AM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: VM group UI: Chooser-view: Group-item layout management rework.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp

    r43887 r43954  
    6464                                         bool fMainRoot)
    6565    : UIGChooserItem(0, true /* temporary? */)
    66     , m_strName(pCopyFrom->name())
    6766    , m_fClosed(pCopyFrom->isClosed())
    6867    , m_fMainRoot(fMainRoot)
     68    , m_strName(pCopyFrom->name())
    6969{
    7070    /* Prepare: */
     
    9292                                         int iPosition /* = -1 */)
    9393    : UIGChooserItem(pParent, pParent->isTemporary())
    94     , m_strName(strName)
    9594    , m_fClosed(!fOpened)
    9695    , m_fMainRoot(false)
     96    , m_strName(strName)
    9797{
    9898    /* Prepare: */
     
    119119                                         int iPosition /* = -1 */)
    120120    : UIGChooserItem(pParent, pParent->isTemporary())
    121     , m_strName(pCopyFrom->name())
    122121    , m_fClosed(pCopyFrom->isClosed())
    123122    , m_fMainRoot(false)
     123    , m_strName(pCopyFrom->name())
    124124{
    125125    /* Prepare: */
     
    210210    updateVisibleName();
    211211    /* Update minimum header size: */
    212     updateHeaderSize();
     212    updateMinimumHeaderSize();
    213213}
    214214
     
    310310        /* Update toggle-state: */
    311311        m_fClosed = true;
     312        /* Update geometry: */
     313        updateGeometry();
    312314        /* Update navigation: */
    313315        model()->updateNavigation();
     
    325327    /* Update toggle-state: */
    326328    m_fClosed = !fToggled;
     329    /* Update geometry: */
     330    updateGeometry();
    327331    /* Update navigation: */
    328332    model()->updateNavigation();
     
    450454    updateVisibleName();
    451455    /* Update minimum header size: */
    452     updateHeaderSize();
     456    updateMinimumHeaderSize();
    453457}
    454458
     
    522526
    523527    /* Update linked values: */
    524     updateHeaderSize();
    525 }
    526 
    527 void UIGChooserItemGroup::updateHeaderSize()
     528    updateMinimumHeaderSize();
     529}
     530
     531void UIGChooserItemGroup::updateMinimumHeaderSize()
    528532{
    529533    /* Not for main root: */
     
    586590        iHeaderHeight = qMax(iHeaderHeight, iHeight);
    587591
    588     /* Return result: */
    589     m_headerSize = QSize(iHeaderWidth, iHeaderHeight);
     592    /* Recache minimum header size: */
     593    m_minimumHeaderSize = QSize(iHeaderWidth, iHeaderHeight);
     594
     595    /* Update linked values: */
     596    updateGeometry();
    590597}
    591598
     
    923930}
    924931
     932void UIGChooserItemGroup::updateGeometry()
     933{
     934    /* Call to base-class: */
     935    UIGChooserItem::updateGeometry();
     936
     937    /* Update parent's geometry: */
     938    if (parentItem())
     939        parentItem()->updateGeometry();
     940}
     941
    925942void UIGChooserItemGroup::updateLayout()
    926943{
    927     /* Update size-hints for all the children: */
    928     foreach (UIGChooserItem *pItem, items())
    929         pItem->updateGeometry();
    930     /* Update size-hint for this item: */
    931     updateGeometry();
    932 
    933944    /* Prepare variables: */
    934945    int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
    935946    int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt();
    936947    int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt();
    937     int iFullHeaderHeight = m_headerSize.height();
     948    int iFullHeaderHeight = m_minimumHeaderSize.height();
    938949    int iRootIndent = data(GroupItemData_RootIndent).toInt();
    939950    int iPreviousVerticalIndent = 0;
     
    10681079    int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
    10691080    int iRootIndent = data(GroupItemData_RootIndent).toInt();
    1070     int iFullHeaderWidth = m_headerSize.width();
     1081    int iFullHeaderWidth = m_minimumHeaderSize.width();
    10711082
    10721083    /* Calculating proposed width: */
     
    11001111    int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt();
    11011112    int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt();
    1102     int iFullHeaderHeight = m_headerSize.height();
     1113    int iFullHeaderHeight = m_minimumHeaderSize.height();
    11031114
    11041115    /* Calculating proposed height: */
     
    13901401    QPoint pos = pEvent->pos().toPoint();
    13911402    int iMargin = data(GroupItemData_VerticalMargin).toInt();
    1392     int iHeaderHeight = m_headerSize.height();
     1403    int iHeaderHeight = m_minimumHeaderSize.height();
    13931404    int iFullHeaderHeight = 2 * iMargin + iHeaderHeight;
    13941405    /* Skip if hovered part out of the header: */
     
    14561467            int iMargin = data(GroupItemData_VerticalMargin).toInt();
    14571468            int iRootIndent = data(GroupItemData_RootIndent).toInt();
    1458             int iHeaderHeight = m_headerSize.height();
     1469            int iHeaderHeight = m_minimumHeaderSize.height();
    14591470            int iFullHeaderHeight = 2 * iMargin + iHeaderHeight;
    14601471            QRect backgroundRect = QRect(0, 0, rect.width(), iFullHeaderHeight);
     
    14871498        /* Prepare variables: */
    14881499        int iMargin = data(GroupItemData_VerticalMargin).toInt();
    1489         int iHeaderHeight = m_headerSize.height();
     1500        int iHeaderHeight = m_minimumHeaderSize.height();
    14901501        int iFullHeaderHeight = 2 * iMargin + iHeaderHeight;
    14911502        int iFullHeight = rect.height();
     
    15651576    int iMajorSpacing = data(GroupItemData_MajorSpacing).toInt();
    15661577    int iRootIndent = data(GroupItemData_RootIndent).toInt();
    1567     int iFullHeaderHeight = m_headerSize.height();
     1578    int iFullHeaderHeight = m_minimumHeaderSize.height();
    15681579
    15691580    /* Configure painter color: */
     
    17001711{
    17011712    m_iAdditionalHeight = iAdditionalHeight;
     1713    updateGeometry();
    17021714    model()->updateLayout();
    17031715}
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h

    r43853 r43954  
    119119    void updateVisibleName();
    120120    void updateItemCountInfo();
    121     void updateHeaderSize();
     121    void updateMinimumHeaderSize();
    122122    void updateToolTip();
    123123    void updateToggleButtonToolTip();
     
    146146
    147147    /* Helpers: Layout stuff: */
     148    void updateGeometry();
    148149    void updateLayout();
    149150    int minimumWidthHint(bool fOpenedGroup) const;
     
    182183
    183184    /* Variables: */
    184     QString m_strName;
    185185    bool m_fClosed;
    186186    UIGraphicsRotatorButton *m_pToggleButton;
     
    196196    int m_iBlackoutDarkness;
    197197    /* Cached values: */
     198    QString m_strName;
    198199    QString m_strVisibleName;
    199200    QString m_strInfoGroups;
     
    204205    QSize m_pixmapSizeGroups;
    205206    QSize m_pixmapSizeMachines;
    206     QSize m_headerSize;
     207    QSize m_minimumHeaderSize;
    207208    QSize m_toggleButtonSize;
    208209    QSize m_enterButtonSize;
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