KTextWidgets 5.109.0
kfinddialog.h
1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2001 S.R. Haque <srhaque@iee.org>.
4 SPDX-FileCopyrightText: 2002 David Faure <david@mandrakesoft.com>
5
6 SPDX-License-Identifier: LGPL-2.0-only
7*/
8
9#ifndef KFINDDIALOG_H
10#define KFINDDIALOG_H
11
12#include "ktextwidgets_export.h"
13
14#include <QDialog>
15#include <memory>
16
17class KFindDialogPrivate;
18
65class KTEXTWIDGETS_EXPORT KFindDialog : public QDialog
66{
67 Q_OBJECT
68
69public:
78 explicit KFindDialog(QWidget *parent = nullptr,
79 long options = 0,
80 const QStringList &findStrings = QStringList(),
81 bool hasSelection = false,
82 bool replaceDialog = false);
83
87 ~KFindDialog() override;
88
97 void setFindHistory(const QStringList &history);
98
104 QStringList findHistory() const;
105
112 void setHasSelection(bool hasSelection);
113
121 void setHasCursor(bool hasCursor);
122
130 void setSupportsBackwardsFind(bool supports);
131
139 void setSupportsCaseSensitiveFind(bool supports);
140
148 void setSupportsWholeWordsFind(bool supports);
149
158
167 void setOptions(long options);
168
176 long options() const;
177
181 QString pattern() const;
182
186 void setPattern(const QString &pattern);
187
194 QWidget *findExtension() const;
195
196Q_SIGNALS:
202
206 void okClicked();
207
212
213protected:
214 void showEvent(QShowEvent *) override;
215
216protected:
217 KTEXTWIDGETS_NO_EXPORT explicit KFindDialog(KFindDialogPrivate &dd,
218 QWidget *parent = nullptr,
219 long options = 0,
220 const QStringList &findStrings = QStringList(),
221 bool hasSelection = false,
222 bool replaceDialog = false);
223
224private:
225 friend class KReplaceDialog;
226 Q_DECLARE_PRIVATE_D(d, KFindDialog)
227 std::unique_ptr<class KFindDialogPrivate> const d;
228 // KF6 TODO: change private d to protected d_ptr, use normal Q_DECLARE_PRIVATE, remove friend
229};
230
231#endif // KFINDDIALOG_H
A generic "find" dialog.
Definition kfinddialog.h:66
void optionsChanged()
This signal is sent whenever one of the option checkboxes is toggled.
void setSupportsBackwardsFind(bool supports)
Enable/disable the 'Find backwards' option, depending on whether the application supports it.
KFindDialog(QWidget *parent=nullptr, long options=0, const QStringList &findStrings=QStringList(), bool hasSelection=false, bool replaceDialog=false)
Construct a modal find dialog.
void setHasCursor(bool hasCursor)
Hide/show the 'from cursor' option, depending on whether the application implements a cursor.
void setSupportsWholeWordsFind(bool supports)
Enable/disable the 'Whole words only' option, depending on whether the application supports it.
void setSupportsCaseSensitiveFind(bool supports)
Enable/disable the 'Case sensitive' option, depending on whether the application supports it.
void setFindHistory(const QStringList &history)
Provide the list of strings to be displayed as the history of find strings.
QStringList findHistory() const
Returns the list of history items.
QString pattern() const
Returns the pattern to find.
void cancelClicked()
This signal is sent when the user clicks on Cancel button.
void setSupportsRegularExpressionFind(bool supports)
Enable/disable the 'Regular expression' option, depending on whether the application supports it.
long options() const
Returns the state of the options.
void setHasSelection(bool hasSelection)
Enable/disable the 'search in selection' option, depending on whether there actually is a selection.
~KFindDialog() override
Destructor.
void okClicked()
This signal is sent when the user clicks on Ok button.
void setOptions(long options)
Set the options which are checked.
void setPattern(const QString &pattern)
Sets the pattern to find.
QWidget * findExtension() const
Returns an empty widget which the user may fill with additional UI elements as required.
A generic "replace" dialog.
Definition kreplacedialog.h:46