1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
3 | #ifndef FINDWIDGET_H |
4 | #define FINDWIDGET_H |
5 | |
6 | #include <QtWidgets/QWidget> |
7 | |
8 | QT_BEGIN_NAMESPACE |
9 | |
10 | class QCheckBox; |
11 | class QLabel; |
12 | class QLineEdit; |
13 | class QToolButton; |
14 | |
15 | class FindWidget : public QWidget |
16 | { |
17 | Q_OBJECT |
18 | public: |
19 | FindWidget(QWidget *parent = nullptr); |
20 | ~FindWidget() override; |
21 | |
22 | void show(); |
23 | void showAndClear(); |
24 | |
25 | QString text() const; |
26 | bool caseSensitive() const; |
27 | |
28 | void setPalette(bool found); |
29 | void setTextWrappedVisible(bool visible); |
30 | |
31 | signals: |
32 | void findNext(); |
33 | void findPrevious(); |
34 | void escapePressed(); |
35 | void find(const QString &text, bool forward, bool incremental); |
36 | |
37 | protected: |
38 | void hideEvent(QHideEvent* event) override; |
39 | void showEvent(QShowEvent * event) override; |
40 | |
41 | private slots: |
42 | void updateButtons(); |
43 | void textChanged(const QString &text); |
44 | |
45 | private: |
46 | bool eventFilter(QObject *object, QEvent *e) override; |
47 | QToolButton* setupToolButton(const QString &text, const QString &icon); |
48 | |
49 | private: |
50 | QPalette appPalette; |
51 | |
52 | QLineEdit *editFind; |
53 | QCheckBox *checkCase; |
54 | QLabel *labelWrapped; |
55 | QToolButton *toolNext; |
56 | QToolButton *toolClose; |
57 | QToolButton *toolPrevious; |
58 | }; |
59 | |
60 | QT_END_NAMESPACE |
61 | |
62 | #endif // FINDWIDGET_H |
63 | |