![]() |
LeechCraft
0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
|
A horizontal bar with typical widgets for text search. More...
#include "findnotification.h"
Public Types | |
enum | FindFlag { FindNoFlags = 0x0, FindCaseSensitively = 0x1, FindBackwards = 0x2, FindWrapsAround = 0x4 } |
Public Member Functions | |
FindNotification (const ICoreProxy_ptr &proxy, QWidget *near) | |
Creates the search widget in parent layout of near. More... | |
~FindNotification () override | |
void | SetEscCloses (bool close) |
Sets whether Esc closes the widget. More... | |
void | SetText (const QString &text) |
Sets the text in the find field. More... | |
QString | GetText () const |
Returns the currently entered text in the find field. More... | |
void | SetSuccessful (bool successful) |
Updates the widget to show whether the search has been successful. More... | |
FindFlags | GetFlags () const |
Returns the current find flags except the direction. More... | |
void | FindNext () |
Search for the next occurrence of the search text. More... | |
void | FindPrevious () |
Search for the previous occurrence of the search text. More... | |
void | Clear () |
Clears the text in the find field. More... | |
![]() | |
PageNotification (QWidget *parent) | |
Creates the widget embedding into the parent layout of the parent widget. More... | |
Protected Member Functions | |
virtual void | HandleNext (const QString &text, FindFlags flags)=0 |
Called each time the user requests a search. More... | |
virtual void | Reject () |
A horizontal bar with typical widgets for text search.
This widget provides typical features for text searching: a text input field, checkboxes for selecting find mode and buttons for searching and closing the notification, as well as convenience slots findNext() and findPrevious().
The widget will automatically be embedded into the layout of the parent widget of near after the near widget (which is passed to the constructor).
This class is typically used as following:
QWebPage::findText()
. The implementation may also call SetSuccessful() to indicate whether anything has been found.triggered()
signal is connected to this class' show() and setFocus() slots (latter is needed so that user can start typing his search query immediately).The FindNotificationWk class provides some utilities to aid integrating this class with a QWebPage.
Definition at line 61 of file findnotification.h.
Various options controlling the search behavior.
Definition at line 68 of file findnotification.h.
LC::Util::FindNotification::FindNotification | ( | const ICoreProxy_ptr & | proxy, |
QWidget * | near | ||
) |
Creates the search widget in parent layout of near.
Embedding is done only if possible — that is, if parent's layout is QVBoxLayout. Otherwise one should place this widget where needed himself.
[in] | proxy | The core proxy to be used by this find notification. |
[in] | near | The widget near which to embed. |
Definition at line 25 of file findnotification.cpp.
|
overridedefault |
void LC::Util::FindNotification::Clear | ( | ) |
Clears the text in the find field.
This is equivalent to SetText ({})
.
Definition at line 129 of file findnotification.cpp.
void LC::Util::FindNotification::FindNext | ( | ) |
Search for the next occurrence of the search text.
If the text has been modified since the previous call to either findPrevious() or findNext() either programmatically (via SetText()) or by the user, the search will be restarted.
Definition at line 111 of file findnotification.cpp.
void LC::Util::FindNotification::FindPrevious | ( | ) |
Search for the previous occurrence of the search text.
If the text has been modified since the previous call to either findPrevious() or findNext() either programmatically (via SetText()) or by the user, the search will be restarted.
Definition at line 120 of file findnotification.cpp.
auto LC::Util::FindNotification::GetFlags | ( | ) | const |
Returns the current find flags except the direction.
Please note that the direction flag (FindBackwards) never appears in the return result.
Definition at line 101 of file findnotification.cpp.
QString LC::Util::FindNotification::GetText | ( | ) | const |
Returns the currently entered text in the find field.
Definition at line 80 of file findnotification.cpp.
|
protectedpure virtual |
Called each time the user requests a search.
Reimplement this function to perform the actual search.
[in] | text | The text to search for. |
[in] | flags | The flags to search with. |
Implemented in LC::Util::FindNotificationWk, and LC::Util::FindNotificationWE.
|
protectedvirtual |
Reimplemented in LC::Util::FindNotificationWk, and LC::Util::FindNotificationWE.
Definition at line 134 of file findnotification.cpp.
Referenced by LC::Util::FindNotificationWE::HandleNext().
void LC::Util::FindNotification::SetEscCloses | ( | bool | close | ) |
Sets whether Esc closes the widget.
[in] | close | Whether pressing Esc button closes the widget. |
Definition at line 70 of file findnotification.cpp.
void LC::Util::FindNotification::SetSuccessful | ( | bool | successful | ) |
Updates the widget to show whether the search has been successful.
[in] | successful | Whether the search has been successful. |
Definition at line 85 of file findnotification.cpp.
void LC::Util::FindNotification::SetText | ( | const QString & | text | ) |
Sets the text in the find field.
This does not trigger the search. To perform the search, call findNext() after calling this method.
[in] | text | The text to set in find field. |
Definition at line 75 of file findnotification.cpp.