VirtualBox

Ignore:
Timestamp:
Nov 13, 2023 4:17:15 PM (16 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
160198
Message:

FE/Qt: bugref:10513: UIAdvancedSettingsDialog: Make sure previously chosen page persists through experience mode change; That is necessary because mode change involves widget filtering thus invalidating vertical scroll-bar position which needs to be recalculated again.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.cpp

    r101723 r102087  
    597597    , m_fSerializationClean(false)
    598598    , m_fClosed(false)
     599    , m_iPageId(0)
    599600    , m_pStatusBar(0)
    600601    , m_pProcessBar(0)
     
    641642#endif
    642643
    643     /* Let's calculate scroll-bar shift: */
    644     int iShift = 0;
     644    /* Cache current page ID for reusing: */
     645    m_iPageId = cId;
     646
     647    /* Let's calculate required scroll-bar position: */
     648    int iPosition = 0;
    645649    /* We'll have to take upper content's margin into account: */
    646650    int iL, iT, iR, iB;
    647651    m_pScrollViewport->layout()->getContentsMargins(&iL, &iT, &iR, &iB);
    648     iShift -= iT;
     652    iPosition -= iT;
    649653    /* And actual page position according to parent: */
    650     const QPoint pnt = m_frames.value(cId)->pos();
    651     iShift += pnt.y();
     654    const QPoint pnt = m_frames.value(m_iPageId)->pos();
     655    iPosition += pnt.y();
    652656    /* Make sure corresponding page is visible: */
    653     m_pScrollArea->requestVerticalScrollBarPosition(iShift);
     657    m_pScrollArea->requestVerticalScrollBarPosition(iPosition);
    654658
    655659#ifndef VBOX_WS_MAC
     
    11101114                          m_pEditorFilter->text(),
    11111115                          m_flags);
     1116
     1117    /* Make sure current page chosen again: */
     1118    /// @todo fix this WORKAROUND properly!
     1119    // Why the heck simple call to
     1120    // QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);
     1121    // isn't enough and we still need some time to let system
     1122    // process the layouts and vertical scroll-bar position?
     1123    QTimer::singleShot(50, this, SLOT(sltCategoryChangedRepeat()));
    11121124}
    11131125
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.h

    r101723 r102087  
    100100    /** Handles category change to @a cId. */
    101101    virtual void sltCategoryChanged(int cId);
     102    /** Repeats handling for category change to cached @a m_iPageId. */
     103    virtual void sltCategoryChangedRepeat() { sltCategoryChanged(m_iPageId); }
    102104
    103105    /** Handles serializartion start. */
     
    241243    bool  m_fClosed;
    242244
     245    /** Holds the current page ID. */
     246    int  m_iPageId;
     247
    243248    /** Holds the dialog optional flags. */
    244249    QMap<QString, QVariant>  m_flags;
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