]> git.sur5r.net Git - minitube/blob - src/exlineedit.h
Update watch file to use releases instead of tags
[minitube] / src / exlineedit.h
1 #ifndef EXLINEEDIT_H
2 #define EXLINEEDIT_H
3
4 #include <QtWidgets>
5
6 class ClearButton : public QAbstractButton {
7
8     Q_OBJECT
9
10 public:
11     ClearButton(QWidget *parent = 0);
12
13 public slots:
14     void textChanged(const QString &text);
15
16 protected:
17     void paintEvent(QPaintEvent *e);
18     void enterEvent(QEvent *e);
19     void leaveEvent(QEvent *e);
20     void mousePressEvent(QMouseEvent *e);
21     void mouseReleaseEvent(QMouseEvent *e);
22
23 private:
24     bool hovered;
25     bool mousePressed;
26 };
27
28 class ExLineEdit : public QWidget {
29
30     Q_OBJECT
31
32 public:
33     ExLineEdit(QWidget *parent = 0);
34     QLineEdit *lineEdit() const { return m_lineEdit; }
35     void setLeftWidget(QWidget *widget);
36     QWidget *leftWidget() const;
37     void clear();
38     QString text();
39     QSize sizeHint() const;
40     void updateGeometries();
41     void setFont(const QFont &font);
42
43 protected:
44     void focusInEvent(QFocusEvent *e);
45     void focusOutEvent(QFocusEvent *e);
46     void keyPressEvent(QKeyEvent *e);
47     void paintEvent(QPaintEvent *e);
48     void resizeEvent(QResizeEvent *e);
49     bool event(QEvent *e);
50     void initStyleOption(QStyleOptionFrame *option) const;
51
52     QWidget *m_leftWidget;
53     QLineEdit *m_lineEdit;
54     ClearButton *m_clearButton;
55 };
56
57 #endif // EXLINEEDIT_H
58