VirtualBox

Ignore:
Timestamp:
Apr 3, 2013 12:46:15 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: QIArrowSplitter: Make sure it has valid minimum-size-hint in 'close' state.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/extensions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowSplitter.cpp

    r44528 r45307  
    3636    /* Setup main-layout */
    3737    VBoxGlobal::setLayoutMargin (mMainLayout, 0);
     38    mMainLayout->setSpacing(3);
    3839
    3940    /* Setup buttons */
     
    6162    /* Install event-filter */
    6263    qApp->installEventFilter (this);
     64
     65    /* Hide child initially: */
     66    toggleWidget();
    6367}
    6468
     
    7983    mSwitchButton->setText (aName);
    8084    emit sigSizeChanged();
     85}
     86
     87QSize QIArrowSplitter::minimumSizeHint() const
     88{
     89    /* Get size-hints: */
     90    QSize switchButtonHint = mSwitchButton->minimumSizeHint();
     91    QSize backButtonHint = mBackButton->minimumSizeHint();
     92    QSize nextButtonHint = mNextButton->minimumSizeHint();
     93    int iChildWidthHint = 0;
     94    int iChildHeightHint = 0;
     95    if (mChild)
     96    {
     97        QSize childHint = mChild->minimumSize();
     98        if (childHint.isNull())
     99            childHint = mChild->minimumSizeHint();
     100        iChildWidthHint = childHint.width();
     101        iChildHeightHint = childHint.height();
     102    }
     103
     104    /* Calculate width-hint: */
     105    int iWidthHint = 0;
     106    iWidthHint += switchButtonHint.width();
     107    iWidthHint += backButtonHint.width();
     108    iWidthHint += nextButtonHint.width();
     109    if (mChild)
     110        iWidthHint = qMax(iWidthHint, iChildWidthHint);
     111
     112    /* Calculate height-hint: */
     113    int iHeightHint = 0;
     114    iHeightHint = qMax(iHeightHint, switchButtonHint.height());
     115    iHeightHint = qMax(iHeightHint, backButtonHint.height());
     116    iHeightHint = qMax(iHeightHint, nextButtonHint.height());
     117    if (mChild && mChild->isVisible())
     118        iHeightHint += mMainLayout->spacing() + iChildHeightHint;
     119
     120    /* Return result: */
     121    return QSize(iWidthHint, iHeightHint);
    81122}
    82123
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowSplitter.h

    r44528 r45307  
    5454    void setName (const QString &aName);
    5555
     56    QSize minimumSizeHint() const;
     57
    5658public slots:
    5759
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