VirtualBox

Changeset 101051 in vbox


Ignore:
Timestamp:
Sep 7, 2023 1:05:21 PM (15 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10513: Unify filter-out logic in UIEditor more universal way; Making it applicable to settings page/frame as well.

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

Legend:

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

    r101031 r101051  
    7979}
    8080
    81 void 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 
    10081void UISettingsPage::revalidate()
    10182{
     
    202183    if (m_pLabelName)
    203184        m_pLabelName->setText(m_strName);
    204 }
    205 
    206 void 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);
    217185}
    218186
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h

    r101031 r101051  
    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 
    189186public slots:
    190187
     
    298295    void setName(const QString &strName);
    299296
    300     /** Filters out contents with description unrelated to passed @a strFilter. */
    301     virtual void filterOut(const QString &strFilter) RT_OVERRIDE;
    302 
    303297protected:
    304298
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIEditor.cpp

    r101030 r101051  
    4343void UIEditor::filterOut(const QString &strFilter)
    4444{
    45     /* Make sure the editor is visible in case if filter is empty: */
     45    /* Propagate filter towards all the children: */
     46    foreach (UIEditor *pEditor, m_editors)
     47        pEditor->filterOut(strFilter);
     48
     49    /* Make sure the editor is visible if filter is empty: */
    4650    bool fVisible = strFilter.isEmpty();
     51
     52    /* If editor still hidden we'll need to make it
     53     * visible if at least one of children is. */
    4754    if (!fVisible)
    4855    {
    49         /* Otherwise we'll have to walk through all the
    50          * descriptions to check whether filter is suitable: */
     56        foreach (UIEditor *pEditor, m_editors)
     57            if (pEditor->isVisibleTo(this))
     58            {
     59                fVisible = true;
     60                break;
     61            }
     62    }
     63
     64    /* If editor still hidden we'll need to make it
     65     * visible if at least one of descriptions suits filter well: */
     66    if (!fVisible)
     67    {
    5168        foreach (const QString &strDescription, description())
    5269            if (strDescription.contains(strFilter, Qt::CaseInsensitive))
     
    5673            }
    5774    }
    58     /* We'll show whole the editor if filter is suitable: */
     75
     76    /* Update widget visibility: */
    5977    setVisible(fVisible);
    6078}
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