VirtualBox

Ignore:
Timestamp:
Feb 12, 2021 3:59:58 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
142789
Message:

FE/Qt: Working on the error indicators of QIComboBox.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIComboBox.cpp

    r85137 r87737  
    2323/* GUI includes: */
    2424#include "QIComboBox.h"
     25#include "QILineEdit.h"
    2526
    2627/* Other VBox includes: */
     
    303304}
    304305
    305 void QIComboBox::mark(bool fError)
    306 {
    307     /* Redirect to combo-box: */
    308     AssertPtrReturnVoid(m_pComboBox);
    309     QPalette palette = m_pComboBox->palette();
    310     if (fError)
    311         palette.setColor(QPalette::Base, QColor(255, 180, 180));
    312     else
    313         palette.setColor(QPalette::Base, m_originalBaseColor);
    314     m_pComboBox->setPalette(palette);
     306void QIComboBox::mark(bool fError, const QString &strErrorMessage /* = QString() */)
     307{
     308    AssertPtrReturnVoid(m_pComboBox);
     309    QILineEdit *pLineEdit = qobject_cast<QILineEdit*>(m_pComboBox->lineEdit());
     310    AssertPtrReturnVoid(pLineEdit);
     311    pLineEdit->mark(fError, strErrorMessage);
    315312}
    316313
     
    388385        AssertPtrReturnVoid(m_pComboBox);
    389386        {
    390             /* Cache original base color: */
    391             m_originalBaseColor = m_pComboBox->palette().color(QPalette::Base);
     387            /* Replace the line edit of the combox box so that we can mark it for errors: */
     388            QILineEdit *pLineEdit = new QILineEdit;
     389            m_pComboBox->setLineEdit(pLineEdit);
    392390            /* Configure combo-box: */
    393391            setFocusProxy(m_pComboBox);
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIComboBox.h

    r85135 r87737  
    119119    /** Defines size adjust @a enmPolicy. */
    120120    void setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy enmPolicy);
    121     /** Paints the file selectors background to a reddish color when @p fError is true. */
    122     void mark(bool fError);
     121    /** Marks the line edit of the combobox. Refer to QILineEdit::mark(..). */
     122    void mark(bool fError, const QString &strErrorMessage = QString());
    123123
    124124public slots:
     
    156156    /** Holds the original combo-box instance. */
    157157    QComboBox *m_pComboBox;
    158 
    159     /** The original background base color. Used when marking/unmarking the combo box. */
    160     QColor m_originalBaseColor;
    161158};
    162159
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette