CValidityLabel: Make use of explicit on constructors
This commit is contained in:
parent
218bd0b33b
commit
71002f4188
|
@ -18,16 +18,14 @@ class CValidityLabel : public QLabel
|
||||||
bool mValid;
|
bool mValid;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CValidityLabel(QWidget* pParent = 0)
|
explicit CValidityLabel(QWidget* pParent = nullptr)
|
||||||
: QLabel(pParent)
|
: QLabel(pParent)
|
||||||
{
|
{
|
||||||
SetValid(true);
|
SetValid(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
CValidityLabel(const QString& rkValidText, const QString& rkInvalidText, QWidget* pParent = 0)
|
explicit CValidityLabel(QString rkValidText, QString rkInvalidText, QWidget* pParent = nullptr)
|
||||||
: QLabel( rkValidText, pParent )
|
: QLabel(rkValidText, pParent), mValidString(std::move(rkValidText)), mInvalidString(std::move(rkInvalidText))
|
||||||
, mValidString( rkValidText )
|
|
||||||
, mInvalidString( rkInvalidText )
|
|
||||||
{
|
{
|
||||||
SetValid(true);
|
SetValid(true);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +39,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns whether we are valid */
|
/** Returns whether we are valid */
|
||||||
inline bool IsValid() const
|
bool IsValid() const
|
||||||
{
|
{
|
||||||
return mValid;
|
return mValid;
|
||||||
}
|
}
|
||||||
|
@ -55,12 +53,12 @@ public slots:
|
||||||
|
|
||||||
if (mValid)
|
if (mValid)
|
||||||
{
|
{
|
||||||
NewPalette.setColor( foregroundRole(), Qt::green );
|
NewPalette.setColor(foregroundRole(), Qt::green);
|
||||||
setText(mValidString);
|
setText(mValidString);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NewPalette.setColor( foregroundRole(), Qt::red );
|
NewPalette.setColor(foregroundRole(), Qt::red);
|
||||||
setText(mInvalidString);
|
setText(mInvalidString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue