bitcoin/src/qt/qvalidatedlineedit.h

44 lines
1.1 KiB
C
Raw Permalink Normal View History

2015-12-13 08:58:29 -08:00
// Copyright (c) 2011-2015 The Bitcoin Core developers
2014-12-12 20:09:33 -08:00
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
2014-11-03 07:16:40 -08:00
#ifndef BITCOIN_QT_QVALIDATEDLINEEDIT_H
#define BITCOIN_QT_QVALIDATEDLINEEDIT_H
2011-07-16 10:01:05 -07:00
#include <QLineEdit>
2011-11-13 04:19:52 -08: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 10:01:05 -07:00
class QValidatedLineEdit : public QLineEdit
{
Q_OBJECT
2011-07-16 10:01:05 -07:00
public:
explicit QValidatedLineEdit(QWidget *parent);
2011-07-22 08:06:37 -07:00
void clear();
void setCheckValidator(const QValidator *v);
bool isValid();
2011-07-16 10:01:05 -07:00
protected:
void focusInEvent(QFocusEvent *evt);
void focusOutEvent(QFocusEvent *evt);
2011-07-16 10:01:05 -07:00
private:
bool valid;
const QValidator *checkValidator;
2011-07-16 10:01:05 -07:00
public Q_SLOTS:
2011-07-16 10:01:05 -07:00
void setValid(bool valid);
void setEnabled(bool enabled);
2011-07-16 10:01:05 -07:00
Q_SIGNALS:
void validationDidChange(QValidatedLineEdit *validatedLineEdit);
private Q_SLOTS:
2011-07-16 10:01:05 -07:00
void markValid();
void checkValidity();
2011-07-16 10:01:05 -07:00
};
2014-11-03 07:16:40 -08:00
#endif // BITCOIN_QT_QVALIDATEDLINEEDIT_H