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
8QT_BEGIN_NAMESPACE
9
10class QCheckBox;
11class QLabel;
12class QLineEdit;
13class QToolButton;
14
15class FindWidget : public QWidget
16{
17 Q_OBJECT
18public:
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
31signals:
32 void findNext();
33 void findPrevious();
34 void escapePressed();
35 void find(const QString &text, bool forward, bool incremental);
36
37protected:
38 void hideEvent(QHideEvent* event) override;
39 void showEvent(QShowEvent * event) override;
40
41private slots:
42 void updateButtons();
43 void textChanged(const QString &text);
44
45private:
46 bool eventFilter(QObject *object, QEvent *e) override;
47 QToolButton* setupToolButton(const QString &text, const QString &icon);
48
49private:
50 QPalette appPalette;
51
52 QLineEdit *editFind;
53 QCheckBox *checkCase;
54 QLabel *labelWrapped;
55 QToolButton *toolNext;
56 QToolButton *toolClose;
57 QToolButton *toolPrevious;
58};
59
60QT_END_NAMESPACE
61
62#endif // FINDWIDGET_H
63

source code of qttools/src/assistant/assistant/findwidget.h