VirtualBox

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


Ignore:
Timestamp:
May 6, 2021 12:53:11 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8161. Saving dialog geometry as it changes

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

    r88874 r88900  
    111111}
    112112
     113void UIVMInformationDialog::resizeEvent(QResizeEvent *pEvent)
     114{
     115    saveDialogGeometry();
     116    QMainWindowWithRestorableGeometryAndRetranslateUi::resizeEvent(pEvent);
     117}
     118
     119void UIVMInformationDialog::moveEvent(QMoveEvent *pEvent)
     120{
     121    QMainWindowWithRestorableGeometryAndRetranslateUi::moveEvent(pEvent);
     122    saveDialogGeometry();
     123}
     124
    113125void UIVMInformationDialog::sltHandlePageChanged(int iIndex)
    114126{
     
    117129}
    118130
    119 void UIVMInformationDialog::sltSaveSettings()
    120 {
    121     /* Save window geometry: */
    122     {
    123         const QRect geo = currentGeometry();
    124         LogRel2(("GUI: UIVMInformationDialog: Saving geometry as: Origin=%dx%d, Size=%dx%d\n",
    125                  geo.x(), geo.y(), geo.width(), geo.height()));
    126         gEDataManager->setSessionInformationDialogGeometry(geo, isCurrentlyMaximized());
    127     }
     131void UIVMInformationDialog::saveDialogGeometry()
     132{
     133    const QRect geo = currentGeometry();
     134    LogRel2(("GUI: UIVMInformationDialog: Saving geometry as: Origin=%dx%d, Size=%dx%d\n",
     135             geo.x(), geo.y(), geo.width(), geo.height()));
     136    gEDataManager->setSessionInformationDialogGeometry(geo, isCurrentlyMaximized());
    128137}
    129138
     
    133142    prepareThis();
    134143    /* Load settings: */
    135     loadSettings();
    136     connect(&uiCommon(), &UICommon::sigAskToCommitData,
    137             this, &UIVMInformationDialog::sltSaveSettings);
     144    loadDialogGeometry();
    138145}
    139146
     
    260267}
    261268
    262 void UIVMInformationDialog::loadSettings()
    263 {
    264     /* Load window geometry: */
    265     {
    266         const QRect geo = gEDataManager->sessionInformationDialogGeometry(this, m_pMachineWindow);
    267         LogRel2(("GUI: UIVMInformationDialog: Restoring geometry to: Origin=%dx%d, Size=%dx%d\n",
    268                  geo.x(), geo.y(), geo.width(), geo.height()));
    269         restoreGeometry(geo);
    270     }
    271 }
     269void UIVMInformationDialog::loadDialogGeometry()
     270{
     271    const QRect geo = gEDataManager->sessionInformationDialogGeometry(this, m_pMachineWindow);
     272    LogRel2(("GUI: UIVMInformationDialog: Restoring geometry to: Origin=%dx%d, Size=%dx%d\n",
     273             geo.x(), geo.y(), geo.width(), geo.height()));
     274    restoreGeometry(geo);
     275}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.h

    r88874 r88900  
    6666
    6767    /** Handles translation event. */
    68     void retranslateUi() /* override */;
    69     void closeEvent(QCloseEvent *pEvent) /* override */;
     68    virtual void retranslateUi() /* override */;
     69    virtual void closeEvent(QCloseEvent *pEvent) /* override */;
     70    virtual void resizeEvent(QResizeEvent *pEvent) /* override */;
     71    virtual void moveEvent(QMoveEvent *pEvent) /* override */;
    7072
    7173private slots:
     
    7375    /** Handles tab-widget page change. */
    7476    void sltHandlePageChanged(int iIndex);
    75     void sltSaveSettings();
    7677
    7778private:
     
    8990    /** Prepares button-box. */
    9091    void prepareButtonBox();
    91     /** Loads settings. */
    92     void loadSettings();
     92    void loadDialogGeometry();
     93    void saveDialogGeometry();
    9394
    9495    /** @name Widget variables.
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