KReplaceDialog Class
A generic "replace" dialog. More...
Header: | #include <KReplaceDialog> |
CMake: | find_package(KF6 REQUIRED COMPONENTS TextWidgets) target_link_libraries(mytarget PRIVATE KF6::TextWidgets) |
Inherits: | KFindDialog |
Public Types
enum | Options { PromptOnReplace, BackReference } |
Public Functions
KReplaceDialog(QWidget *parent = nullptr, long options = 0, const QStringList &findStrings = QStringList(), const QStringList &replaceStrings = QStringList(), bool hasSelection = true) | |
virtual | ~KReplaceDialog() override |
long | options() const |
QWidget * | replaceExtension() const |
QString | replacement() const |
QStringList | replacementHistory() const |
void | setOptions(long options) |
void | setReplacementHistory(const QStringList &history) |
Detailed Description
Detail:
This widget inherits from KFindDialog and implements the following additional functionalities: a replacement string object and an area for a user-defined widget to extend the dialog.
Example:
To use the basic replace dialog:
To use your own extensions:
Member Type Documentation
enum KReplaceDialog::Options
Constant | Value | Description |
---|---|---|
KReplaceDialog::PromptOnReplace | 256 | Should the user be prompted before the replace operation? |
KReplaceDialog::BackReference | 512 | Use a back reference in the regular expression. |
Member Function Documentation
[explicit]
KReplaceDialog::KReplaceDialog(QWidget *parent = nullptr, long options = 0, const QStringList &findStrings = QStringList(), const QStringList &replaceStrings = QStringList(), bool hasSelection = true)
Construct a replace dialog.read-only or rather select-only combo box with a parent object and a name.
parent The parent object of this widget
options A bitfield of the Options to be enabled.
findStrings A QStringList to insert in the combo box of text to find
replaceStrings A QStringList to insert in the combo box of text to replace with
hasSelection Whether a selection exists
[override virtual noexcept]
KReplaceDialog::~KReplaceDialog()
Destructor.
long KReplaceDialog::options() const
Returns the state of the options. Disabled options may be returned in an indeterminate state.
See also setOptions.
QWidget *KReplaceDialog::replaceExtension() const
Returns an empty widget which the user may fill with additional UI elements as required. The widget occupies the width of the dialog, and is positioned immediately the regular expression support widgets for the replacement string.
QString KReplaceDialog::replacement() const
Returns the replacement string.
QStringList KReplaceDialog::replacementHistory() const
Returns the list of history items.
See also setReplacementHistory.
void KReplaceDialog::setOptions(long options)
Set the options which are enabled.
options The setting of the Options.
See also options().
void KReplaceDialog::setReplacementHistory(const QStringList &history)
Provide the list of strings to be displayed as the history of replacement strings. The history might get truncated if it is too long.
See also replacementHistory.