2016-04-14 13:47:27 +00:00
|
|
|
#ifndef TEXTFIELD_H
|
|
|
|
#define TEXTFIELD_H
|
|
|
|
|
2016-04-14 14:11:41 +00:00
|
|
|
#include <QLineEdit>
|
2016-04-14 13:47:27 +00:00
|
|
|
|
2016-04-14 15:15:17 +00:00
|
|
|
class QPropertyAnimation;
|
|
|
|
|
2016-04-14 14:11:41 +00:00
|
|
|
class TextField : public QLineEdit
|
2016-04-14 13:47:27 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2016-04-14 15:15:17 +00:00
|
|
|
Q_PROPERTY(qreal progress WRITE setProgress READ progress NOTIFY progressChanged)
|
|
|
|
|
2016-04-14 13:47:27 +00:00
|
|
|
public:
|
|
|
|
explicit TextField(QWidget *parent = 0);
|
|
|
|
~TextField();
|
|
|
|
|
2016-04-14 15:15:17 +00:00
|
|
|
void setProgress(qreal progress);
|
|
|
|
inline qreal progress() const { return _progress; }
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void progressChanged(qreal);
|
|
|
|
|
2016-04-14 13:47:27 +00:00
|
|
|
protected:
|
2016-04-14 15:15:17 +00:00
|
|
|
void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
|
|
|
|
void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
|
2016-04-14 13:47:27 +00:00
|
|
|
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
|
|
|
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
2016-04-14 15:15:17 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
QPropertyAnimation *const _animation;
|
|
|
|
qreal _progress;
|
2016-04-14 13:47:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TEXTFIELD_H
|