2014-12-17 02:47:57 +01:00
|
|
|
// 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
|
2013-11-04 16:20:43 +01:00
|
|
|
// 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
|
2013-01-23 21:51:02 +01:00
|
|
|
|
2011-07-16 19:01:05 +02:00
|
|
|
public:
|
2013-11-20 15:56:51 +01:00
|
|
|
explicit QValidatedLineEdit(QWidget *parent);
|
2011-07-22 17:06:37 +02:00
|
|
|
void clear();
|
2013-11-20 15:56:51 +01:00
|
|
|
void setCheckValidator(const QValidator *v);
|
2011-07-16 19:01:05 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void focusInEvent(QFocusEvent *evt);
|
2013-11-20 15:56:51 +01:00
|
|
|
void focusOutEvent(QFocusEvent *evt);
|
2011-07-16 19:01:05 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool valid;
|
2013-11-20 15:56:51 +01:00
|
|
|
const QValidator *checkValidator;
|
2011-07-16 19:01:05 +02:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void setValid(bool valid);
|
2013-11-20 15:56:51 +01:00
|
|
|
void setEnabled(bool enabled);
|
2011-07-16 19:01:05 +02:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void markValid();
|
2013-11-20 15:56:51 +01:00
|
|
|
void checkValidity();
|
2011-07-16 19:01:05 +02:00
|
|
|
};
|
|
|
|
|
2014-11-03 16:16:40 +01:00
|
|
|
#endif // BITCOIN_QT_QVALIDATEDLINEEDIT_H
|