KTextWidgets 5.109.0
Public Types | Public Member Functions | Protected Member Functions | List of all members
KReplaceDialog

A generic "replace" dialog. More...

#include <KReplaceDialog>

Public Types

enum  Options { PromptOnReplace = 256 , BackReference = 512 }
 Options. More...
 

Public Member Functions

 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.
 
 ~KReplaceDialog () override
 Destructor.
 
long options () const
 Returns the state of the options.
 
QWidget * replaceExtension () const
 Returns an empty widget which the user may fill with additional UI elements as required.
 
QString replacement () const
 Returns the replacement string.
 
QStringList replacementHistory () const
 Returns the list of history items.
 
void setOptions (long options)
 Set the options which are enabled.
 
void setReplacementHistory (const QStringList &history)
 Provide the list of strings to be displayed as the history of replacement strings.
 
- Public Member Functions inherited from KFindDialog
 KFindDialog (QWidget *parent=nullptr, long options=0, const QStringList &findStrings=QStringList(), bool hasSelection=false, bool replaceDialog=false)
 Construct a modal find dialog.
 
 ~KFindDialog () override
 Destructor.
 
QWidget * findExtension () const
 Returns an empty widget which the user may fill with additional UI elements as required.
 
QStringList findHistory () const
 Returns the list of history items.
 
long options () const
 Returns the state of the options.
 
QString pattern () const
 Returns the pattern to find.
 
void setFindHistory (const QStringList &history)
 Provide the list of strings to be displayed as the history of find strings.
 
void setHasCursor (bool hasCursor)
 Hide/show the 'from cursor' option, depending on whether the application implements a cursor.
 
void setHasSelection (bool hasSelection)
 Enable/disable the 'search in selection' option, depending on whether there actually is a selection.
 
void setOptions (long options)
 Set the options which are checked.
 
void setPattern (const QString &pattern)
 Sets the pattern to find.
 
void setSupportsBackwardsFind (bool supports)
 Enable/disable the 'Find backwards' 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 setSupportsRegularExpressionFind (bool supports)
 Enable/disable the 'Regular expression' option, depending on whether the application supports it.
 
void setSupportsWholeWordsFind (bool supports)
 Enable/disable the 'Whole words only' option, depending on whether the application supports it.
 

Protected Member Functions

void showEvent (QShowEvent *) override
 
- Protected Member Functions inherited from KFindDialog
KTEXTWIDGETS_NO_EXPORT KFindDialog (KFindDialogPrivate &dd, QWidget *parent=nullptr, long options=0, const QStringList &findStrings=QStringList(), bool hasSelection=false, bool replaceDialog=false)
 
void showEvent (QShowEvent *) override
 

Additional Inherited Members

- Signals inherited from KFindDialog
void cancelClicked ()
 This signal is sent when the user clicks on Cancel button.
 
void okClicked ()
 This signal is sent when the user clicks on Ok button.
 
void optionsChanged ()
 This signal is sent whenever one of the option checkboxes is toggled.
 

Detailed Description

A generic "replace" dialog.

Author
S.R.Haque srhaq.nosp@m.ue@i.nosp@m.ee.or.nosp@m.g

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:

KReplaceDialog Widget

Member Enumeration Documentation

◆ Options

Options.

Enumerator
PromptOnReplace 

Should the user be prompted before the replace operation?

Constructor & Destructor Documentation

◆ KReplaceDialog()

KReplaceDialog::KReplaceDialog ( QWidget *  parent = nullptr,
long  options = 0,
const QStringList &  findStrings = QStringList(),
const QStringList &  replaceStrings = QStringList(),
bool  hasSelection = true 
)
explicit

Construct a replace dialog.read-only or rather select-only combo box with a parent object and a name.

Parameters
parentThe parent object of this widget
optionsA bitfield of the Options to be enabled.
findStringsA QStringList to insert in the combo box of text to find
replaceStringsA QStringList to insert in the combo box of text to replace with
hasSelectionWhether a selection exists

◆ ~KReplaceDialog()

KReplaceDialog::~KReplaceDialog ( )
override

Destructor.

Member Function Documentation

◆ options()

long KReplaceDialog::options ( ) const

Returns the state of the options.

Disabled options may be returned in an indeterminate state.

See also
setOptions

◆ replaceExtension()

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.

◆ replacement()

QString KReplaceDialog::replacement ( ) const

Returns the replacement string.

◆ replacementHistory()

QStringList KReplaceDialog::replacementHistory ( ) const

Returns the list of history items.

See also
setReplacementHistory

◆ setOptions()

void KReplaceDialog::setOptions ( long  options)

Set the options which are enabled.

Parameters
optionsThe setting of the Options.

◆ setReplacementHistory()

void KReplaceDialog::setReplacementHistory ( const QStringList &  history)

Provide the list of strings to be displayed as the history of replacement strings.

strings might get truncated if it is too long.

Parameters
historyThe replacement history.
See also
replacementHistory