Changeset 78060 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Apr 9, 2019 1:42:43 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UISearchLineEdit.cpp
r77723 r78060 27 27 , m_iMatchCount(0) 28 28 , m_iScrollToIndex(-1) 29 , m_fMark(true) 30 , m_unmarkColor(palette().color(QPalette::Base)) 31 , m_markColor(QColor(m_unmarkColor.red(), 32 0.5 * m_unmarkColor.green(), 33 0.5 * m_unmarkColor.blue())) 29 34 { 30 35 } … … 36 41 /* No search terms. no search. nothing to show here: */ 37 42 if (text().isEmpty()) 43 { 44 colorBackground(false); 38 45 return; 39 46 } 40 47 /* Draw the total match count and the current scrolled item's index on the right hand side of the line edit: */ 41 48 QPainter painter(this); … … 57 64 painter.drawText(QRect(width() - textSize.width() - iRightMargin, iTopMargin, textSize.width(), textSize.height()), 58 65 Qt::AlignCenter | Qt::AlignVCenter, strText); 66 colorBackground(m_iMatchCount == 0); 59 67 } 60 68 … … 74 82 repaint(); 75 83 } 84 85 void UISearchLineEdit::colorBackground(bool fWarning) 86 { 87 QPalette mPalette = palette(); 88 /** Make sure we reset color. */ 89 if (!fWarning || !m_fMark) 90 { 91 mPalette.setColor(QPalette::Base, m_unmarkColor); 92 setPalette(mPalette); 93 return; 94 } 95 96 if (m_fMark && fWarning) 97 { 98 mPalette.setColor(QPalette::Base, m_markColor); 99 setPalette(mPalette); 100 return; 101 } 102 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UISearchLineEdit.h
r77723 r78060 49 49 private: 50 50 51 void colorBackground(bool fWarning); 52 51 53 /** Stores the total number of matched items. */ 52 int m_iMatchCount;54 int m_iMatchCount; 53 55 /** Stores the index of the currently scrolled/made-visible item withing the list of search results. 54 56 * Must be smaller that or equal to m_iMatchCount. */ 55 int m_iScrollToIndex; 57 int m_iScrollToIndex; 58 /** When true we color line edit background with a more reddish color. */ 59 bool m_fMark; 60 QColor m_unmarkColor; 61 QColor m_markColor; 56 62 }; 57 63
Note:
See TracChangeset
for help on using the changeset viewer.