lbrycrd/src/qt/qvalidatedlineedit.h

40 lines
995 B
C
Raw Normal View History

// Copyright (c) 2011-2013 The Bitcoin Core developers
2014-12-13 05:09:33 +01:00
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
2014-11-03 16:16:40 +01:00
#ifndef BITCOIN_QT_QVALIDATEDLINEEDIT_H
#define BITCOIN_QT_QVALIDATEDLINEEDIT_H
2011-07-16 19:01:05 +02:00
#include <QLineEdit>
2011-11-13 13:19:52 +01:00
/** Line edit that can be marked as "invalid" to show input validation feedback. When marked as invalid,
it will get a red background until it is focused.
*/
2011-07-16 19:01:05 +02:00
class QValidatedLineEdit : public QLineEdit
{
Q_OBJECT
2011-07-16 19:01:05 +02:00
public:
explicit QValidatedLineEdit(QWidget *parent);
2011-07-22 17:06:37 +02:00
void clear();
void setCheckValidator(const QValidator *v);
2011-07-16 19:01:05 +02:00
protected:
void focusInEvent(QFocusEvent *evt);
void focusOutEvent(QFocusEvent *evt);
2011-07-16 19:01:05 +02:00
private:
bool valid;
const QValidator *checkValidator;
2011-07-16 19:01:05 +02:00
public slots:
void setValid(bool valid);
void setEnabled(bool enabled);
2011-07-16 19:01:05 +02:00
private slots:
void markValid();
void checkValidity();
2011-07-16 19:01:05 +02:00
};
2014-11-03 16:16:40 +01:00
#endif // BITCOIN_QT_QVALIDATEDLINEEDIT_H