VirtualBox

Changeset 77812 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 20, 2019 4:33:59 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9378. Handling keybord focus a bit better.

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

Legend:

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

    r77752 r77812  
    522522    else
    523523    {
    524         if (m_iCurrentScrolledIndex < 0)
     524        if (--m_iCurrentScrolledIndex < 0)
    525525            m_iCurrentScrolledIndex = m_searchResults.size() - 1;
    526526    }
     
    828828void UIChooserModel::sltShowHideSearchWidget()
    829829{
    830     UIChooserView *pChooserView = view();
    831     if (!pChooserView)
    832         return;
    833     pChooserView->toggleSearchWidget();
     830    if (view())
     831        setSearchWidgetVisible(!view()->isSearchWidgetVisible());
    834832}
    835833
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserSearchWidget.cpp

    r77779 r77812  
    117117    if (m_pLineEdit)
    118118    {
    119         connect(m_pLineEdit, &QILineEdit::textEdited,
     119        connect(m_pLineEdit, &QILineEdit::textChanged,
    120120                this, &UIChooserSearchWidget::sltHandleSearchTermChange);
    121121    }
     
    163163        {
    164164            if (pKeyEvent->key() == Qt::Key_Escape)
     165            {
    165166                emit sigToggleVisibility(false);
     167                return true;
     168            }
     169            else if (pKeyEvent->key() == Qt::Key_Up || pKeyEvent->key() == Qt::Key_Down)
     170            {
     171                emit sigScrollToMatch(pKeyEvent->key() == Qt::Key_Down);
     172                return true;
     173            }
    166174        }
    167175    }
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserView.cpp

    r77750 r77812  
    102102}
    103103
    104 void UIChooserView::toggleSearchWidget()
     104bool UIChooserView::isSearchWidgetVisible() const
    105105{
    106106    if (!m_pSearchWidget)
    107         return;
    108     bool fVisible = m_pSearchWidget->isVisible();
    109     setSearchWidgetVisible(!fVisible);
     107        return false;
     108    return m_pSearchWidget->isVisible();
    110109}
    111110
     
    114113    if (!m_pSearchWidget)
    115114        return;
     115
     116    /** Make sure keyboard focus is managed ccorectly. */
     117    if (fVisible)
     118        m_pSearchWidget->setFocus();
     119    else
     120        setFocus();
     121
    116122    if (m_pSearchWidget->isVisible() == fVisible)
    117123        return;
     
    121127
    122128    UIChooserModel *pModel =  m_pChooser->model();
    123     if (!pModel)
    124         return;
    125     pModel->resetSearch();
     129    if (pModel)
     130        pModel->resetSearch();
    126131}
    127132
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserView.h

    r77750 r77812  
    5454    /** @name Virtual Machine search stuff.
    5555      * @{ */
    56         /** Shows/hides machine search widget. */
    57         void toggleSearchWidget();
    58         /** Shows/hides machine search widget. */
     56        /** Returns if the search widget is visible or not. */
     57        bool isSearchWidgetVisible() const;
     58        /** Shows/hides wrt. @a fVisible machine search widget. */
    5959        void setSearchWidgetVisible(bool fVisible);
    6060        /** Updates the search widget's counts. */
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