Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
abstractfindwidget_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the Qt API. It exists for the convenience
9// of Qt Designer. This header file may change from version to version
10// without notice, or even be removed.
11//
12// We mean it.
13//
14
15#ifndef ABSTRACTFINDWIDGET_H
16#define ABSTRACTFINDWIDGET_H
17
18#include <QtGui/QIcon>
19#include <QtWidgets/QWidget>
20
22
23class QAction;
24class QCheckBox;
25class QEvent;
26class QKeyEvent;
27class QLabel;
28class QLineEdit;
29class QObject;
30class QToolButton;
31
33{
35
36public:
37 enum FindFlag {
38 /// Use a layout that is roughly half as wide and twice as high as the regular one.
40 /// Do not show the "Whole words" checkbox.
42 /// Do not show the "Case sensitive" checkbox.
44 };
45 Q_DECLARE_FLAGS(FindFlags, FindFlag)
46
49
50 bool eventFilter(QObject *object, QEvent *e) override;
51
52 static QIcon findIconSet();
53 QAction *createFindAction(QObject *parent);
54
55public slots:
56 void activate();
57 virtual void deactivate();
58 void findNext();
59 void findPrevious();
60 void findCurrentText();
61
62protected:
63 void keyPressEvent(QKeyEvent *event) override;
64
65private slots:
66 void updateButtons();
67
68protected:
69 virtual void find(const QString &textToFind, bool skipCurrent, bool backward, bool *found, bool *wrapped) = 0;
70
71 bool caseSensitive() const;
72 bool wholeWords() const;
73
74private:
75 void findInternal(const QString &textToFind, bool skipCurrent, bool backward);
76
77 QLineEdit *m_editFind;
78 QLabel *m_labelWrapped;
79 QToolButton *m_toolNext;
80 QToolButton *m_toolClose;
81 QToolButton *m_toolPrevious;
82 QCheckBox *m_checkCase;
83 QCheckBox *m_checkWholeWords;
84};
85
86Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractFindWidget::FindFlags)
87
88QT_END_NAMESPACE
89
90#endif // ABSTRACTFINDWIDGET_H
A search bar that is commonly added below a searchable widget.
virtual void deactivate()
Deactivates the find widget, making it invisible and handing focus to any associated QTextEdit.
~AbstractFindWidget() override
Destroys the AbstractFindWidget.
void keyPressEvent(QKeyEvent *event) override
This event handler, for event event, can be reimplemented in a subclass to receive key press events f...
static QIcon findIconSet()
Returns the icon set to be used for the action that initiates a search.
QAction * createFindAction(QObject *parent)
Creates an actions with standard icon and shortcut to activate the widget.
bool eventFilter(QObject *object, QEvent *e) override
Filters events if this object has been installed as an event filter for the watched object.
A search bar that is commonly added below the searchable text.
void setTextEdit(QTextEdit *textEdit)
Associates a QTextEdit with this find widget.
void find(const QString &textToFind, bool skipCurrent, bool backward, bool *found, bool *wrapped) override
\reimp
QTextEdit * textEdit() const
void deactivate() override
\reimp
Combined button and popup list for selecting options.