VirtualBox

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


Ignore:
Timestamp:
Sep 6, 2023 3:06:02 PM (16 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10513: Re-inheriting UISettingsPage and UISetingsPageFrame from UIEditor; Overriding their filtering stuff to move responsibility to children editors.

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

Legend:

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

    r101028 r101031  
    7979}
    8080
     81void UISettingsPage::filterOut(const QString &strFilter)
     82{
     83    /* Propagate filter towards all the children: */
     84    foreach (UIEditor *pEditor, m_editors)
     85        pEditor->filterOut(strFilter);
     86
     87    /* Check if at least one of children visible: */
     88    bool fVisible = false;
     89    foreach (UIEditor *pEditor, m_editors)
     90        if (pEditor->isVisibleTo(this))
     91        {
     92            fVisible = true;
     93            break;
     94        }
     95
     96    /* Update page visibility: */
     97    setVisible(fVisible);
     98}
     99
    81100void UISettingsPage::revalidate()
    82101{
     
    166185
    167186UISettingsPageFrame::UISettingsPageFrame(UISettingsPage *pPage, QWidget *pParent /* = 0 */)
    168     : QWidget(pParent)
     187    : UIEditor(pParent)
    169188    , m_pPage(pPage)
    170189    , m_pLabelName(0)
     
    183202    if (m_pLabelName)
    184203        m_pLabelName->setText(m_strName);
     204}
     205
     206void UISettingsPageFrame::filterOut(const QString &strFilter)
     207{
     208    /* Propagate filter to the child: */
     209    AssertReturnVoid(m_editors.size() == 1);
     210    m_editors.first()->filterOut(strFilter);
     211
     212    /* Check if child visible: */
     213    const bool fVisible = m_editors.first()->isVisibleTo(this);
     214
     215    /* Update frame visibility: */
     216    setVisible(fVisible);
     217}
     218
     219void UISettingsPageFrame::retranslateUi()
     220{
     221    // No NLS tags for now; We are receiving our name through the getter.
    185222}
    186223
     
    293330            m_pLayout = new QVBoxLayout(m_pWidget);
    294331            if (m_pLayout)
     332            {
    295333                m_pLayout->addWidget(m_pPage);
     334                /// @todo what about removal handling?
     335                m_editors << m_pPage;
     336            }
    296337            pLayoutMain->addWidget(m_pWidget);
    297338        }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h

    r101028 r101031  
    9191
    9292
    93 /** QWidget subclass used as settings page interface. */
    94 class UISettingsPage : public QIWithRetranslateUI<QWidget>
     93/** UIEditor sub-class used as settings page interface. */
     94class UISettingsPage : public UIEditor
    9595{
    9696    Q_OBJECT;
     
    184184    virtual void polishPage() {}
    185185
     186    /** Filters out contents with description unrelated to passed @a strFilter. */
     187    virtual void filterOut(const QString &strFilter) RT_OVERRIDE;
     188
    186189public slots:
    187190
     
    281284
    282285
    283 /** QWidget sub-class, used as settings page frame. */
    284 class UISettingsPageFrame : public QWidget
     286/** UIEditor sub-class, used as settings page frame. */
     287class UISettingsPageFrame : public UIEditor
    285288{
    286289    Q_OBJECT;
     
    295298    void setName(const QString &strName);
    296299
     300    /** Filters out contents with description unrelated to passed @a strFilter. */
     301    virtual void filterOut(const QString &strFilter) RT_OVERRIDE;
     302
    297303protected:
     304
     305    /** Handles translation event. */
     306    virtual void retranslateUi() RT_OVERRIDE;
    298307
    299308    /** Handles paint @a pEvent. */
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