Konsole
Konsole::IncrementalSearchBar Class Reference
A widget which allows users to search incrementally through a document for a a text string or regular expression. More...
#include <IncrementalSearchBar.h>

Public Types | |
enum | Continue { ContinueFromTop, ContinueFromBottom, ClearContinue } |
enum | Features { HighlightMatches = 1, MatchCase = 2, RegExp = 4, AllFeatures = HighlightMatches | MatchCase | RegExp } |
Signals | |
void | closeClicked () |
void | findNextClicked () |
void | findPreviousClicked () |
void | highlightMatchesToggled (bool) |
void | matchCaseToggled (bool) |
void | matchRegExpToggled (bool) |
void | searchChanged (const QString &text) |
Public Member Functions | |
bool | highlightMatches () |
IncrementalSearchBar (Features features, QWidget *parent=0) | |
bool | matchCase () |
bool | matchRegExp () |
QString | searchText () |
void | setContinueFlag (Continue flag) |
void | setFoundMatch (bool match) |
virtual void | setVisible (bool visible) |
Protected Member Functions | |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
Detailed Description
A widget which allows users to search incrementally through a document for a a text string or regular expression.The widget consists of a text box into which the user can enter their search text and buttons to trigger a search for the next and previous matches for the search text.
When the search text is changed, the searchChanged() signal is emitted. A search through the document for the new text should begin immediately and the active view of the document should jump to display any matches if found. setFoundMatch() should be called whenever the search text changes to indicate whether a match for the text was found in the document.
findNextClicked() and findPreviousClicked() signals are emitted when the user presses buttons to find next and previous matches respectively.
The search bar has a number of optional features which can be enabled or disabled by passing a set of Features flags to the constructor.
An optional checkbox can be displayed to indicate whether all matches in the document for searchText() should be highlighted. The highlightMatchesToggled() signal is emitted when this checkbox is toggled.
The two further optional checkboxes allow the user to control the matching process. The first indicates whether searches are case sensitive. The matchCaseToggled() signal is emitted when this is changed. The second indicates whether the search text should be treated as a plain string or as a regular expression. The matchRegExpToggled() signal is emitted when this is changed.
Definition at line 64 of file IncrementalSearchBar.h.
Member Enumeration Documentation
- Enumerator:
Definition at line 69 of file IncrementalSearchBar.h.
This enum defines the features which can be supported by an implementation of an incremental search bar.
- Enumerator:
Definition at line 90 of file IncrementalSearchBar.h.
Constructor & Destructor Documentation
Constructs a new incremental search bar with the given parent widget features
specifies the features which should be made available to the user.
Definition at line 40 of file IncrementalSearchBar.cpp.
Member Function Documentation
void Konsole::IncrementalSearchBar::closeClicked | ( | ) | [signal] |
Emitted when the close button is clicked.
Definition at line 194 of file IncrementalSearchBar.cpp.
void Konsole::IncrementalSearchBar::findNextClicked | ( | ) | [signal] |
Emitted when the user clicks the button to find the next match.
void Konsole::IncrementalSearchBar::findPreviousClicked | ( | ) | [signal] |
Emitted when the user clicks the button to find the previous match.
bool IncrementalSearchBar::highlightMatches | ( | ) |
Returns whether matches for the current search text should be highlighted in the document.
Always returns true if the highlight matches checkbox is not visible.
Definition at line 160 of file IncrementalSearchBar.cpp.
void Konsole::IncrementalSearchBar::highlightMatchesToggled | ( | bool | ) | [signal] |
Emitted when the user toggles the checkbox to indicate whether matches for the search text should be highlighted.
bool IncrementalSearchBar::matchCase | ( | ) |
Returns whether matching for the current search text should be case sensitive.
Always returns false if the match case checkbox is not visible.
Definition at line 171 of file IncrementalSearchBar.cpp.
void Konsole::IncrementalSearchBar::matchCaseToggled | ( | bool | ) | [signal] |
Emitted when the user toggles the checkbox to indicate whether matching for the search text should be case sensitive.
bool IncrementalSearchBar::matchRegExp | ( | ) |
Returns whether the current search text should be treated as plain text or a regular expression Always returns false if the match regular expression checkbox is not visible.
Definition at line 182 of file IncrementalSearchBar.cpp.
void Konsole::IncrementalSearchBar::matchRegExpToggled | ( | bool | ) | [signal] |
Emitted when the user toggles the checkbox to indicate whether the search text should be treated as a plain string or a regular expression.
void Konsole::IncrementalSearchBar::searchChanged | ( | const QString & | text | ) | [signal] |
Emitted when the text entered in the search box is altered.
QString IncrementalSearchBar::searchText | ( | ) |
void IncrementalSearchBar::setContinueFlag | ( | Continue | flag | ) |
Sets a flag to indicate that the current search for matches has reached the top or bottom of the document and has been continued again from the other end of the document.
This flag will be cleared when the user presses the buttons to find a next or previous match.
Definition at line 242 of file IncrementalSearchBar.cpp.
void IncrementalSearchBar::setFoundMatch | ( | bool | match | ) |
Sets an indicator for the user as to whether or not a match for the current search text was found in the document.
The indicator will not be shown if the search text is empty ( because the user has not yet entered a query ).
- Parameters:
-
match True if a match was found or false otherwise. If true, and the search text is non-empty, an indicator that no matches were found will be shown.
Definition at line 225 of file IncrementalSearchBar.cpp.
void IncrementalSearchBar::setVisible | ( | bool | visible | ) | [virtual] |
Definition at line 213 of file IncrementalSearchBar.cpp.
The documentation for this class was generated from the following files: