VirtualBox

Changeset 10717 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 17, 2008 10:30:35 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
33442
Message:

FE/Qt4-OSX: Fix the animation if the widget is zooming.

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSettingsDialog.h

    r10604 r10717  
    8989    QTimer *mWhatsThisTimer;
    9090    QWidget *mWhatsThisCandidate;
     91
     92#ifdef Q_WS_MAC
     93    QList<QSize> mSizeList;
     94#endif /* Q_WS_MAC */
    9195};
    9296
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSettingsDialog.cpp

    r10604 r10717  
    199199    mStack->setCurrentIndex (mStack->indexOf (rootPage));
    200200#else /* Q_WS_MAC */
    201     /* We will update at once later */
    202     setUpdatesEnabled (false);
     201    QSize cs = size();
     202    /* First make all fully resizeable */
    203203    setMinimumSize (QSize (minimumWidth(), 0));
    204204    setMaximumSize (QSize (minimumWidth(), QWIDGETSIZE_MAX));
    205     /* Set all tab size policies to ignored */
    206     QList<QWidget*> list = mSelector->rootPages ();
    207     for (int i = 0; i < list.count(); ++i)
    208         list.at (i)->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Ignored);
    209     /* Set the size policy of the current tab to preferred */
    210     if (mStack->widget (mStack->indexOf (rootPage)))
    211         mStack->widget (mStack->indexOf (rootPage))->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred);
    212     /* Set the new current tab */
    213     mLbTitle->setText (mSelector->itemText (aId));
    214     mStack->setCurrentIndex (mStack->indexOf (rootPage));
    215     /* Activate the new layout */
    216     layout()->activate();
    217     setUpdatesEnabled (true);
    218     //        mAllWidget->hide();
    219     QSize s = minimumSize();
    220     int minWidth = mSelector->minWidth();
    221     if (minWidth > s.width())
    222         s.setWidth (minWidth);
    223     /* Play the resize animation */
    224     ::darwinWindowAnimateResize (this, QRect (x(), y(),
    225                                               s.width(), s.height()));
    226     //        mAllWidget->show();
    227     /* Set the new size to Qt also */
    228     setFixedSize (s);
     205    for (int i = 0; i < mStack->count(); ++i)
     206        mStack->widget (i)->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Ignored);
     207    int a = mStack->indexOf (rootPage);
     208    if (a < mSizeList.count())
     209    {
     210        QSize ss = mSizeList.at (a);
     211        mStack->widget (a)->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred);
     212        /* Switch to the new page first if we are shrinking */
     213        if (cs.height() > ss.height())
     214            mStack->setCurrentIndex (mStack->indexOf (rootPage));
     215        /* Do the animation */
     216        ::darwinWindowAnimateResize (this, QRect (x(), y(),
     217                                                  ss.width(), ss.height()));
     218        /* Switch to the new page last if we are zooming */
     219        if (cs.height() <= ss.height())
     220            mStack->setCurrentIndex (mStack->indexOf (rootPage));
     221        /* Make the widget fixed size */
     222        setFixedSize (ss);
     223    }
    229224#endif /* !Q_WS_MAC */
    230225# ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
     
    327322{
    328323    QIMainDialog::showEvent (aEvent);
    329 
    330324    /* One may think that QWidget::polish() is the right place to do things
    331325     * below, but apparently, by the time when QWidget::polish() is called,
     
    339333    mPolished = true;
    340334
     335#ifdef Q_WS_MAC
     336    /* Set all size policies to ignored */
     337    for (int i = 0; i < mStack->count(); ++i)
     338        mStack->widget (i)->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Ignored);
     339    /* Activate every single page to get the optimal size */
     340    for (int i = mStack->count() - 1; i >= 0; --i)
     341    {
     342        mStack->widget (i)->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred);
     343        mStack->setCurrentIndex (i);
     344        layout()->activate();
     345        mSizeList.insert (0, minimumSize());
     346        mStack->widget (i)->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Ignored);
     347    }
     348
     349    categoryChanged (mSelector->currentId());
     350#else /* Q_WS_MAC */
    341351    /* Resize to the minimum possible size */
    342352    int minWidth = mSelector->minWidth();
     
    344354    if (minWidth > s.width())
    345355        s.setWidth (minWidth);
    346 #ifdef Q_WS_MAC
    347     categoryChanged (mSelector->currentId());
    348 #else /* Q_WS_MAC */
    349356    resize (s);
    350357#endif /* Q_WS_MAC */
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