VirtualBox

Changeset 41175 in vbox for trunk/src


Ignore:
Timestamp:
May 5, 2012 2:29:39 PM (13 years ago)
Author:
vboxsync
Message:

FE/Qt: 6141: Fixing another crash (in QIMessageBox and QIArrowSplitter) which were happening if settings-dialog was opened during VM poweroff/shutdown.

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

Legend:

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

    r28800 r41175  
    7878{
    7979    mSwitchButton->setText (aName);
    80     relayout();
     80    emit sigSizeChanged();
    8181}
    8282
     
    8484{
    8585    mChild->setVisible (mSwitchButton->isExpanded());
    86     relayout();
     86    emit sigSizeChanged();
    8787}
    8888
     
    139139}
    140140
    141 void QIArrowSplitter::relayout()
    142 {
    143     /* Update full layout system of message window */
    144     QList <QLayout*> layouts = findChildren <QLayout*> ();
    145     foreach (QLayout *item, layouts)
    146     {
    147         item->update();
    148         item->activate();
    149     }
    150 
    151     /* Update main layout of message window at last */
    152     window()->layout()->update();
    153     window()->layout()->activate();
    154     qApp->processEvents();
    155 
    156     /* Now resize window to minimum possible size */
    157     window()->resize (window()->minimumSizeHint());
    158     qApp->processEvents();
    159 
    160     /* Check if we have to make dialog fixed in height */
    161     if (mSwitchButton->isExpanded())
    162         window()->setMaximumHeight (QWIDGETSIZE_MAX);
    163     else
    164         window()->setFixedHeight (window()->minimumSizeHint().height());
    165 }
    166 
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowSplitter.h

    r28800 r41175  
    6262    void showBackDetails();
    6363    void showNextDetails();
     64    void sigSizeChanged();
    6465
    6566private:
    6667
    6768    bool eventFilter (QObject *aObject, QEvent *aEvent);
    68 
    69     void relayout();
    7069
    7170    QVBoxLayout *mMainLayout;
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIDialog.cpp

    r28800 r41175  
    2525#endif /* Q_WS_MAC */
    2626
    27 /* Qt includes */
    28 #include <QPointer>
    29 
    3027QIDialog::QIDialog (QWidget *aParent /* = 0 */, Qt::WindowFlags aFlags /* = 0 */)
    3128    : QDialog (aParent, aFlags)
    3229    , mPolished (false)
    33     , mEventLoop (0)
    3430{
    3531}
     
    8985
    9086    /* Create a local event loop */
    91     mEventLoop = new QEventLoop();
     87    QEventLoop eventLoop;
     88    mEventLoop = &eventLoop;
    9289    /* Show the window if requested */
    9390    if (aShow)
     
    9693    QPointer<QIDialog> guard = this;
    9794    /* Start the event loop. This blocks. */
    98     mEventLoop->exec();
    99     /* Delete the event loop */
    100     delete mEventLoop;
    101     mEventLoop = 0;
     95    eventLoop.exec();
    10296    /* Are we valid anymore? */
    10397    if (guard.isNull())
    10498        return QDialog::Rejected;
     99    mEventLoop = 0;
    105100    /* Save the result code in case we delete ourself */
    106101    QDialog::DialogCode res = (QDialog::DialogCode)result();
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIDialog.h

    r28800 r41175  
    2222/* Qt includes */
    2323#include <QDialog>
     24#include <QPointer>
    2425
    2526/* Qt forwards declarations */
     
    4344    /* Private member vars */
    4445    bool mPolished;
    45     QEventLoop *mEventLoop;
     46    QPointer<QEventLoop> mEventLoop;
    4647};
    4748
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.cpp

    r38977 r41175  
    137137    connect (mDetailsSplitter, SIGNAL (showBackDetails()), this, SLOT (detailsBack()));
    138138    connect (mDetailsSplitter, SIGNAL (showNextDetails()), this, SLOT (detailsNext()));
     139    connect (mDetailsSplitter, SIGNAL (sigSizeChanged()), this, SLOT (sltUpdateSize()));
    139140    detailsVBoxLayout->addWidget (mDetailsSplitter);
    140141
     
    369370        /* Polishing sub-widgets */
    370371        resize (minimumSizeHint());
    371         qApp->processEvents();
    372372        mTextLabel->useSizeHintForWidth (mTextLabel->width());
    373373        mTextLabel->updateGeometry();
    374         qApp->processEvents();
    375374        setFixedWidth (width());
    376375        mDetailsSplitter->toggleWidget();
     
    434433        mSpacer->changeSize (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    435434    }
     435}
     436
     437void QIMessageBox::sltUpdateSize()
     438{
     439    /* Update/activate all the layouts of the message-box: */
     440    QList<QLayout*> layouts = findChildren<QLayout*>();
     441    for (int i = 0; i < layouts.size(); ++i)
     442    {
     443        QLayout *pItem = layouts.at(i);
     444        pItem->update();
     445        pItem->activate();
     446    }
     447    QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);
     448
     449    /* Now resize message-box to the minimum possible size: */
     450    resize(minimumSizeHint());
    436451}
    437452
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.h

    r38185 r41175  
    2222/* VBox includes */
    2323#include "QIDialog.h"
    24 #include "QIArrowSplitter.h"
    2524
    2625/* Qt includes */
     
    105104private slots:
    106105
     106    void sltUpdateSize();
     107
    107108    void detailsBack();
    108109    void detailsNext();
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