CSoftValidatorLineEdit: Make use of Qt 5 signals and slots

This commit is contained in:
Lioncash 2020-07-03 07:12:41 -04:00
parent 9fac1a8b00
commit 57e1b272e9
1 changed files with 5 additions and 8 deletions

View File

@ -14,13 +14,13 @@ class CSoftValidatorLineEdit : public CTimedLineEdit
Q_OBJECT
/** The validator that input is checked against */
QValidator* mpSoftValidator;
QValidator* mpSoftValidator = nullptr;
/** Whether to only validate when the user stops typing. Good for slow validators. */
bool mOnlyValidateOnFinishedTyping;
bool mOnlyValidateOnFinishedTyping = false;
/** Whether the current input is valid */
bool mInputIsValid;
bool mInputIsValid = true;
signals:
/** Emitted when the validity of the input changes */
@ -62,11 +62,8 @@ protected slots:
}
public:
CSoftValidatorLineEdit(QWidget *pParent = 0)
explicit CSoftValidatorLineEdit(QWidget *pParent = nullptr)
: CTimedLineEdit(pParent)
, mpSoftValidator(nullptr)
, mOnlyValidateOnFinishedTyping(false)
, mInputIsValid(true)
{}
/** Set the soft validator to use */
@ -81,7 +78,7 @@ public:
if (pValidator)
{
mpSoftValidator = pValidator;
connect(mpSoftValidator, SIGNAL(changed()), this, SLOT(InternalUpdate()));
connect(mpSoftValidator, &QValidator::changed, this, &CSoftValidatorLineEdit::InternalUpdate);
}
InternalUpdate();