1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
#ifndef LINEEDITWIDGET_H
#define LINEEDITWIDGET_H
#include <QLineEdit>
#include <QToolButton>
#include <QList>
class QFrame;
class QHBoxLayout;
class LineEditWidget : public QLineEdit
{
Q_OBJECT
Q_PROPERTY(int optimalLength READ optimalLenth WRITE setOptimalLength)
Q_PROPERTY(QString rxValidator READ rxValidator WRITE setRxValidator)
public:
explicit LineEditWidget(QWidget *parent = 0);
~LineEditWidget();
// reimplemented
QSize sizeHint() const;
void showEvent(QShowEvent *e);
bool eventFilter(QObject *o, QEvent *e);
// Properties
int optimalLenth() const { return _optimalLength; }
void setOptimalLength(int optimalLength) { _optimalLength = optimalLength; }
QString rxValidator() const { return _rxValidator; }
void setRxValidator(const QString &str);
protected:
void addWidget(QWidget *w);
void setPopup(QWidget* w);
QFrame *popup() const { return _popup; };
protected slots:
virtual void showPopup();
virtual void hidePopup();
private:
QHBoxLayout *_layout;
QList<QWidget*> _toolbuttons;
QFrame *_popup;
// Properties
int _optimalLength;
QString _rxValidator;
};
#endif // LINEEDITWIDGET_H
|