CTimedLineEdit: Make use of Qt 5 signals and slots
This commit is contained in:
parent
57e1b272e9
commit
d05d767d66
|
@ -10,20 +10,19 @@ class CTimedLineEdit : public QLineEdit
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
QString mCachedText;
|
QString mCachedText;
|
||||||
float mTimeoutDuration;
|
float mTimeoutDuration{0.3f};
|
||||||
QTimer mTimer;
|
QTimer mTimer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CTimedLineEdit(QWidget *pParent = 0)
|
explicit CTimedLineEdit(QWidget *pParent = nullptr)
|
||||||
: QLineEdit(pParent)
|
: QLineEdit(pParent)
|
||||||
, mTimeoutDuration(0.3f)
|
|
||||||
{
|
{
|
||||||
connect(this, SIGNAL(textChanged(QString)), this, SLOT(OnTextChanged()));
|
connect(this, &CTimedLineEdit::textChanged, this, &CTimedLineEdit::OnTextChanged);
|
||||||
connect(&mTimer, SIGNAL(timeout()), this, SLOT(OnTimeout()));
|
connect(&mTimer, &QTimer::timeout, this, &CTimedLineEdit::OnTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetTimeoutDuration(float Duration) { mTimeoutDuration = Duration; }
|
void SetTimeoutDuration(float Duration) { mTimeoutDuration = Duration; }
|
||||||
inline float TimeoutDuration() const { return mTimeoutDuration; }
|
float TimeoutDuration() const { return mTimeoutDuration; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void StoppedTyping(const QString& rkText);
|
void StoppedTyping(const QString& rkText);
|
||||||
|
|
Loading…
Reference in New Issue