VirtualBox

Changeset 77765 in vbox


Ignore:
Timestamp:
Mar 18, 2019 4:22:11 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9378. Adding a tool button for hiding the search widget. Mostly for accessibility.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserSearchWidget.cpp

    r77757 r77765  
    3333    , m_pScrollToNextMatchButton(0)
    3434    , m_pScrollToPreviousMatchButton(0)
     35    , m_pCloseButton(0)
    3536{
    3637    /** Have a background. In some cases having no background causes strange artefacts in Cinnamon themes. */
     
    3839    prepareWidgets();
    3940    prepareConnections();
     41    retranslateUi();
    4042}
    4143
     
    6870    m_pMainLayout->setSpacing(2);
    6971    m_pMainLayout->setContentsMargins(0, 0, 0, 0);
     72
     73    m_pCloseButton = new QIToolButton;
     74    if (m_pCloseButton)
     75    {
     76        m_pCloseButton->setIcon(UIIconPool::iconSet(":/close_16px.png"));
     77        m_pMainLayout->addWidget(m_pCloseButton, 0, Qt::AlignLeft);
     78    }
     79
    7080    m_pLineEdit = new UISearchLineEdit;
    7181    if (m_pLineEdit)
     
    7888    if (m_pScrollToPreviousMatchButton)
    7989    {
    80         m_pScrollToPreviousMatchButton->setIcon(UIIconPool::iconSet(":/log_viewer_search_backward_16px.png", ":/log_viewer_search_backward_disabled_16px.png"));
     90        m_pScrollToPreviousMatchButton->setIcon(UIIconPool::iconSet(":/log_viewer_search_backward_16px.png",
     91                                                                    ":/log_viewer_search_backward_disabled_16px.png"));
    8192        m_pMainLayout->addWidget(m_pScrollToPreviousMatchButton);
    8293    }
     
    8495    if (m_pScrollToNextMatchButton)
    8596    {
    86         m_pScrollToNextMatchButton->setIcon(UIIconPool::iconSet(":/log_viewer_search_forward_16px.png", ":/log_viewer_search_forward_disabled_16px.png"));
     97        m_pScrollToNextMatchButton->setIcon(UIIconPool::iconSet(":/log_viewer_search_forward_16px.png",
     98                                                                ":/log_viewer_search_forward_disabled_16px.png"));
    8799        m_pMainLayout->addWidget(m_pScrollToNextMatchButton);
    88100    }
     
    98110                this, &UIChooserSearchWidget::sltHandleSearchTermChange);
    99111    }
     112    if (m_pCloseButton)
     113        connect(m_pCloseButton, &QIToolButton::clicked, this, &UIChooserSearchWidget::sltHandleCloseButtonClick);
    100114    if (m_pScrollToPreviousMatchButton)
    101115        connect(m_pScrollToPreviousMatchButton, &QIToolButton::clicked, this, &UIChooserSearchWidget::sltHandleScroolToButtonClick);
     
    120134void UIChooserSearchWidget::retranslateUi()
    121135{
     136    if (m_pScrollToNextMatchButton)
     137        m_pScrollToNextMatchButton->setToolTip(tr("Navigate to the next item among the search results"));
     138    if (m_pScrollToPreviousMatchButton)
     139        m_pScrollToPreviousMatchButton->setToolTip(tr("Navigate to the previous item among the search results"));
     140    if (m_pLineEdit)
     141        m_pLineEdit->setToolTip(tr("Enter a search term to be used during virtual machine search"));
     142    if (m_pCloseButton)
     143        m_pCloseButton->setToolTip(tr("Close the search widget"));
    122144}
    123145
     
    149171        emit sigScrollToMatch(false);
    150172}
     173
     174void UIChooserSearchWidget::sltHandleCloseButtonClick()
     175{
     176    emit sigToggleVisibility(false);
     177}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserSearchWidget.h

    r77750 r77765  
    5151
    5252    UIChooserSearchWidget(QWidget *pParent);
     53    /** Forward @a iMatchCount to UISearchLineEdit. */
    5354    void setMatchCount(int iMatchCount);
     55    /** Forward @a iScrollToIndex to UISearchLineEdit. */
    5456    void setScroolToIndex(int iScrollToIndex);
    5557    /** Appends the @a strSearchText to the current (if any) search text. */
     
    6769private slots:
    6870
     71    /** Emits sigRedoSearch thuse causes a re-search. */
    6972    void sltHandleSearchTermChange(const QString &strSearchTerm);
    7073    void sltHandleScroolToButtonClick();
     74    /** Emits sigToggleVisibility, */
     75    void sltHandleCloseButtonClick();
    7176
    7277private:
     
    7580    void prepareConnections();
    7681
    77     UISearchLineEdit  *m_pLineEdit;
    78     QHBoxLayout       *m_pMainLayout;
    79     QIToolButton      *m_pScrollToNextMatchButton;
    80     QIToolButton      *m_pScrollToPreviousMatchButton;
     82    /** @name Member widgets.
     83      * @{ */
     84        UISearchLineEdit  *m_pLineEdit;
     85        QHBoxLayout       *m_pMainLayout;
     86        QIToolButton      *m_pScrollToNextMatchButton;
     87        QIToolButton      *m_pScrollToPreviousMatchButton;
     88        QIToolButton      *m_pCloseButton;
     89    /** @} */
    8190};
    8291
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