KFindDialog Class Reference
from PyKDE4.kdeui import *
Inherits: KDialog → QDialog → QWidget → QObject
Subclasses: KReplaceDialog
Detailed Description
A generic "find" dialog.
Detail:
This widget inherits from KDialog and implements the following additional functionalities: a find string object and an area for a user-defined widget to extend the dialog.
Example:
To use the basic modal find dialog, and then run the search:
KFindDialog dlg(....) if ( dlg.exec() != QDialog.Accepted ) return; // proceed with KFind from here
To create a non-modal find dialog:
if ( m_findDia ) KWindowSystem.activateWindow( m_findDia->winId() ); else { m_findDia = new KFindDialog(false,...); connect( m_findDia, SIGNAL(okClicked()), this, SLOT(findTextNext()) ); }Don't forget to delete and reset m_findDia when closed. (But do NOT delete your KFind object at that point, it's needed for "Find Next".)
- Note:
- If using a non-modal find dialog, in the slot connected to the okClicked() signal you need to check if a regular expression has been entered and if so, whether it is valid. Otherwise, if it is invalid, the user will see an error message followed unexpectedly by a search taking place.
if ( (m_findDia->options() & KFind.RegularExpression) && !QRegExp(m_findDia->pattern()).isValid() ) { // Don't attempt to search }
To use your own extensions: see findExtension().
"KDE Find Dialog"
Signals | |
optionsChanged () | |
Methods | |
__init__ (self, QWidget parent=0, long options=0, QStringList findStrings=QStringList(), bool hasSelection=0, bool replaceDialog=0) | |
QWidget | findExtension (self) |
QStringList | findHistory (self) |
long | options (self) |
QString | pattern (self) |
setFindHistory (self, QStringList history) | |
setHasCursor (self, bool hasCursor) | |
setHasSelection (self, bool hasSelection) | |
setOptions (self, long options) | |
setPattern (self, QString pattern) | |
setSupportsBackwardsFind (self, bool supports) | |
setSupportsCaseSensitiveFind (self, bool supports) | |
setSupportsRegularExpressionFind (self, bool supports) | |
setSupportsWholeWordsFind (self, bool supports) | |
showEvent (self, QShowEvent a0) |
Signal Documentation
optionsChanged | ( | ) |
This signal is sent whenever one of the option checkboxes is toggled. Call options() to get the new state of the checkboxes.
- Signal syntax:
QObject.connect(source, SIGNAL("optionsChanged()"), target_slot)
Method Documentation
__init__ | ( | self, | ||
QWidget | parent=0, | |||
long | options=0, | |||
QStringList | findStrings=QStringList(), | |||
bool | hasSelection=0, | |||
bool | replaceDialog=0 | |||
) |
Construct a modal find dialog
- Parameters:
-
parent The parent object of this widget. options A bitfield of the Options to be checked. findStrings The find history, see findHistory() hasSelection Whether a selection exists
QWidget findExtension | ( | self ) |
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 below the regular expression support widgets for the pattern string.
QStringList findHistory | ( | self ) |
Returns the list of history items.
- See also:
- setFindHistory
long options | ( | self ) |
Returns the state of the options. Disabled options may be returned in an indeterminate state.
- See also:
- setOptions()
- See also:
- KFind.Options
QString pattern | ( | self ) |
Returns the pattern to find.
setFindHistory | ( | self, | ||
QStringList | history | |||
) |
Provide the list of strings to be displayed as the history of find strings. strings might get truncated if it is too long.
- Parameters:
-
history The find history.
- See also:
- findHistory
setHasCursor | ( | self, | ||
bool | hasCursor | |||
) |
Hide/show the 'from cursor' option, depending on whether the application implements a cursor.
- Parameters:
-
hasCursor true if the application features a cursor This is assumed to be the case by default.
setHasSelection | ( | self, | ||
bool | hasSelection | |||
) |
Enable/disable the 'search in selection' option, depending on whether there actually is a selection.
- Parameters:
-
hasSelection true if a selection exists
setOptions | ( | self, | ||
long | options | |||
) |
Set the options which are checked.
- Parameters:
-
options The setting of the Options.
- See also:
- options()
- See also:
- KFind.Options
setPattern | ( | self, | ||
QString | pattern | |||
) |
Sets the pattern to find
setSupportsBackwardsFind | ( | self, | ||
bool | supports | |||
) |
Enable/disable the 'Find backwards' option, depending on whether the application supports it.
- Parameters:
-
supports true if the application supports backwards find This is assumed to be the case by default.
setSupportsCaseSensitiveFind | ( | self, | ||
bool | supports | |||
) |
Enable/disable the 'Case sensitive' option, depending on whether the application supports it.
- Parameters:
-
supports true if the application supports case sensitive find This is assumed to be the case by default.
setSupportsRegularExpressionFind | ( | self, | ||
bool | supports | |||
) |
Enable/disable the 'Regular expression' option, depending on whether the application supports it.
- Parameters:
-
supports true if the application supports regular expression find This is assumed to be the case by default.
setSupportsWholeWordsFind | ( | self, | ||
bool | supports | |||
) |
Enable/disable the 'Whole words only' option, depending on whether the application supports it.
- Parameters:
-
supports true if the application supports whole words only find This is assumed to be the case by default.
showEvent | ( | self, | ||
QShowEvent | a0 | |||
) |