VirtualBox

Changeset 89046 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 14, 2021 1:37:15 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8161. saving vm infomation dialog's geometry in a delayed fashion

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.cpp

    r88900 r89046  
    6262    , m_pMachineWindow(pMachineWindow)
    6363    , m_fCloseEmitted(false)
     64    , m_iGeometrySaveTimerId(-1)
    6465{
    6566    /* Prepare: */
     
    111112}
    112113
    113 void UIVMInformationDialog::resizeEvent(QResizeEvent *pEvent)
    114 {
    115     saveDialogGeometry();
    116     QMainWindowWithRestorableGeometryAndRetranslateUi::resizeEvent(pEvent);
    117 }
    118 
    119 void UIVMInformationDialog::moveEvent(QMoveEvent *pEvent)
    120 {
    121     QMainWindowWithRestorableGeometryAndRetranslateUi::moveEvent(pEvent);
    122     saveDialogGeometry();
     114bool UIVMInformationDialog::event(QEvent *pEvent)
     115{
     116    switch (pEvent->type())
     117    {
     118        case QEvent::Resize:
     119        case QEvent::Move:
     120        {
     121            if (m_iGeometrySaveTimerId != -1)
     122                killTimer(m_iGeometrySaveTimerId);
     123            m_iGeometrySaveTimerId = startTimer(300);
     124            break;
     125        }
     126        case QEvent::Timer:
     127        {
     128            QTimerEvent *pTimerEvent = static_cast<QTimerEvent*>(pEvent);
     129            if (pTimerEvent->timerId() == m_iGeometrySaveTimerId)
     130            {
     131                killTimer(m_iGeometrySaveTimerId);
     132                m_iGeometrySaveTimerId = -1;
     133                saveDialogGeometry();
     134            }
     135            break;
     136        }
     137        default:
     138            break;
     139    }
     140    return QMainWindowWithRestorableGeometryAndRetranslateUi::event(pEvent);
    123141}
    124142
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.h

    r88900 r89046  
    6868    virtual void retranslateUi() /* override */;
    6969    virtual void closeEvent(QCloseEvent *pEvent) /* override */;
    70     virtual void resizeEvent(QResizeEvent *pEvent) /* override */;
    71     virtual void moveEvent(QMoveEvent *pEvent) /* override */;
     70    virtual bool event(QEvent *pEvent) /* override */;
    7271
    7372private slots:
     
    105104    /** @} */
    106105    bool m_fCloseEmitted;
     106    int m_iGeometrySaveTimerId;
    107107};
    108108
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