VirtualBox

Changeset 78058 in vbox for trunk/src


Ignore:
Timestamp:
Apr 9, 2019 12:02:30 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699. Marking the search line edit when there are no matches.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp

    r78055 r78058  
    783783        m_pSearchLineEdit->hide();
    784784        m_pSearchLineEdit->setClearButtonEnabled(true);
     785        m_searchLineUnmarkColor = m_pSearchLineEdit->palette().color(QPalette::Base);
     786        m_searchLineMarkColor = QColor(m_searchLineUnmarkColor.green(),
     787                                       0.5 * m_searchLineUnmarkColor.green(),
     788                                       0.5 * m_searchLineUnmarkColor.blue());
    785789        connect(m_pSearchLineEdit, &QLineEdit::textChanged,
    786790                this, &UIFileManagerTable::sltSearchTextChanged);
     
    13021306                if (m_pSearchLineEdit)
    13031307                {
     1308                    markUnmarkSearchLineEdit(false);
    13041309                    m_pSearchLineEdit->clear();
    13051310                    m_pSearchLineEdit->show();
     
    14691474void UIFileManagerTable::performSelectionSearch(const QString &strSearchText)
    14701475{
    1471     if (!m_pProxyModel | !m_pView || strSearchText.isEmpty())
    1472         return;
     1476    if (!m_pProxyModel | !m_pView)
     1477        return;
     1478
     1479    if (strSearchText.isEmpty())
     1480    {
     1481        markUnmarkSearchLineEdit(false);
     1482        return;
     1483    }
    14731484
    14741485    int rowCount = m_pProxyModel->rowCount(m_pView->rootIndex());
     
    14931504        setSelection(index);
    14941505    }
     1506    markUnmarkSearchLineEdit(!pFoundItem);
    14951507}
    14961508
     
    15321544}
    15331545
     1546void UIFileManagerTable::markUnmarkSearchLineEdit(bool fMark)
     1547{
     1548    if (!m_pSearchLineEdit)
     1549        return;
     1550    QPalette palette = m_pSearchLineEdit->palette();
     1551
     1552    if (fMark)
     1553        palette.setColor(QPalette::Base, m_searchLineMarkColor);
     1554    else
     1555        palette.setColor(QPalette::Base, m_searchLineUnmarkColor);
     1556    m_pSearchLineEdit->setPalette(palette);
     1557}
     1558
    15341559#include "UIFileManagerTable.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.h

    r78024 r78058  
    283283     *  if deletion can continue */
    284284    bool            checkIfDeleteOK();
     285    /** Marks/umarks the search line edit to signal that there are no matches for the current search.
     286      * uses m_searchLineUnmarkColor and m_searchLineMarkColor. */
     287    void            markUnmarkSearchLineEdit(bool fMark);
    285288
    286289    UICustomFileSystemModel      *m_pModel;
     
    290293    QGridLayout     *m_pMainLayout;
    291294    QILineEdit      *m_pSearchLineEdit;
     295    QColor           m_searchLineUnmarkColor;
     296    QColor           m_searchLineMarkColor;
    292297    QILabel         *m_pWarningLabel;
    293298
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