VirtualBox

Changeset 86081 in vbox


Ignore:
Timestamp:
Sep 10, 2020 11:41:22 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9827: A bit of fixes for QIMainDialog and UISettingsDialog polishing stuff; A call to corresponding virtual event handler should be guarded itself, cause it's virtual; Sub-classes should adjust geometry before base-class polishing call, not after it.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
3 edited

Legend:

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

    r82968 r86081  
    218218void QIMainDialog::showEvent(QShowEvent *pEvent)
    219219{
    220     /* Call to polish-event: */
    221     polishEvent(pEvent);
     220    /* Polish dialog if necessary: */
     221    if (!m_fPolished)
     222    {
     223        polishEvent(pEvent);
     224        m_fPolished = true;
     225    }
    222226
    223227    /* Call to base-class: */
     
    227231void QIMainDialog::polishEvent(QShowEvent *)
    228232{
    229     /* Make sure we should polish dialog: */
    230     if (m_fPolished)
    231         return;
    232 
    233233    /* Explicit centering according to our parent: */
    234234    if (m_fIsAutoCentering)
    235235        UICommon::centerWidget(this, parentWidget(), false);
    236 
    237     /* Mark dialog as polished: */
    238     m_fPolished = true;
    239236}
    240237
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp

    r85881 r86081  
    5353    , m_pSelector(0)
    5454    , m_pStack(0)
    55     , m_fPolished(false)
    5655    , m_enmConfigurationAccessLevel(ConfigurationAccessLevel_Null)
    5756    , m_pSerializeProcess(0)
     
    268267}
    269268
    270 void UISettingsDialog::showEvent(QShowEvent *pEvent)
    271 {
    272     /* Base-class processing: */
    273     QIMainDialog::showEvent(pEvent);
    274 
    275     /* One may think that QWidget::polish() is the right place to do things
    276      * below, but apparently, by the time when QWidget::polish() is called,
    277      * the widget style & layout are not fully done, at least the minimum
    278      * size hint is not properly calculated. Since this is sometimes necessary,
    279      * we provide our own "polish" implementation. */
    280     if (m_fPolished)
    281         return;
    282 
    283     m_fPolished = true;
    284 
    285     int iMinWidth = m_pSelector->minWidth();
     269void UISettingsDialog::polishEvent(QShowEvent *pEvent)
     270{
     271    /* Check what's the minimum selector size: */
     272    const int iMinWidth = m_pSelector->minWidth();
    286273
    287274#ifdef VBOX_WS_MAC
     
    337324
    338325#endif /* VBOX_WS_MAC */
     326
     327    /* Call to base-class: */
     328    QIWithRetranslateUI<QIMainDialog>::polishEvent(pEvent);
    339329}
    340330
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h

    r85881 r86081  
    9191    /** Handles translation event. */
    9292    virtual void retranslateUi() /* override */;
    93     /** Handles show @a pEvent. */
    94     virtual void showEvent(QShowEvent *pEvent) /* override */;
     93    /** Handles first show @a pEvent. */
     94    virtual void polishEvent(QShowEvent *pEvent) /* override */;
    9595
    9696    /** Returns the serialize process instance. */
     
    170170    void assignValidator(UISettingsPage *pPage);
    171171
    172     /** Holds whether the dialog is polished. */
    173     bool  m_fPolished;
    174 
    175172    /** Holds configuration access level. */
    176173    ConfigurationAccessLevel  m_enmConfigurationAccessLevel;
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