dogecoin/src/qt/qvalidatedlineedit.h

44 lines
1.1 KiB
C
Raw Permalink Normal View History

2015-12-13 17:58:29 +01:00
// Copyright (c) 2011-2015 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);
bool isValid();
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 Q_SLOTS:
2011-07-16 19:01:05 +02:00
void setValid(bool valid);
void setEnabled(bool enabled);
2011-07-16 19:01:05 +02:00
Q_SIGNALS:
void validationDidChange(QValidatedLineEdit *validatedLineEdit);
private Q_SLOTS:
2011-07-16 19:01:05 +02:00
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