VirtualBox

Changeset 89042 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
May 14, 2021 12:43:04 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8161. saving softkeyboard's geometry in a delayed fashion

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp

    r88922 r89042  
    38543854    , m_pSettingsWidget(0)
    38553855    , m_pStatusBarWidget(0)
     3856    , m_iGeometrySaveTimerId(-1)
    38563857{
    38573858    setWindowTitle(QString("%1 - %2").arg(m_strMachineName).arg(tr("Soft Keyboard")));
     
    39073908}
    39083909
    3909 void UISoftKeyboard::resizeEvent(QResizeEvent *pEvent)
    3910 {
    3911     QMainWindowWithRestorableGeometryAndRetranslateUi::resizeEvent(pEvent);
    3912     saveDialogGeometry();
    3913 }
    3914 
    3915 void UISoftKeyboard
    3916 ::moveEvent(QMoveEvent *pEvent)
    3917 {
    3918     QMainWindowWithRestorableGeometryAndRetranslateUi::moveEvent(pEvent);
    3919     saveDialogGeometry();
    3920 }
    3921 
    39223910bool UISoftKeyboard::event(QEvent *pEvent)
    39233911{
     
    39363924        }
    39373925    }
     3926    else if (pEvent->type() == QEvent::Resize ||
     3927             pEvent->type() == QEvent::Move)
     3928    {
     3929        if (m_iGeometrySaveTimerId != -1)
     3930            killTimer(m_iGeometrySaveTimerId);
     3931        m_iGeometrySaveTimerId = startTimer(300);
     3932    }
     3933    else if (pEvent->type() == QEvent::Timer)
     3934    {
     3935        QTimerEvent *pTimerEvent = static_cast<QTimerEvent*>(pEvent);
     3936        if (pTimerEvent->timerId() == m_iGeometrySaveTimerId)
     3937        {
     3938            killTimer(m_iGeometrySaveTimerId);
     3939            m_iGeometrySaveTimerId = -1;
     3940            saveDialogGeometry();
     3941        }
     3942    }
     3943
    39383944    return QMainWindowWithRestorableGeometryAndRetranslateUi::event(pEvent);
    39393945}
  • trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.h

    r88912 r89042  
    7070    virtual bool shouldBeMaximized() const /* override */;
    7171    virtual void closeEvent(QCloseEvent *event) /* override */;
    72     virtual void resizeEvent(QResizeEvent *pEvent) /* override */;
    73     virtual void moveEvent(QMoveEvent *pEvent) /* override */;
    7472    bool event(QEvent *pEvent) /* override */;
    7573
     
    135133    UISoftKeyboardSettingsWidget  *m_pSettingsWidget;
    136134    UISoftKeyboardStatusBarWidget *m_pStatusBarWidget;
     135    int m_iGeometrySaveTimerId;
    137136};
    138137
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