15#include "ui_findnotification.h"
22 , EscShortcut_ { new QShortcut { Qt::Key_Escape, this, this, &
FindNotification::Reject } }
26 setFocusProxy (Ui_->Pattern_);
28 EscShortcut_->setContext (Qt::WidgetWithChildrenShortcut);
48 connect (Ui_->Pattern_,
49 &QLineEdit::textChanged,
50 [
this] (
const auto& str) { Ui_->FindButton_->setEnabled (!str.isEmpty ()); });
51 connect (Ui_->FindButton_,
52 &QPushButton::released,
55 auto flags = GetFlags ();
56 if (Ui_->SearchBackwards_->checkState () == Qt::Checked)
57 flags |= FindBackwards;
58 HandleNext (Ui_->Pattern_->text (), flags);
60 connect (Ui_->CloseButton_,
61 &QPushButton::released,
70 EscShortcut_->setEnabled (close);
75 Ui_->Pattern_->setText (text);
80 return Ui_->Pattern_->text ();
85 auto ss = QStringLiteral (
"QLineEdit { background-color: ");
87 ss.append (
"#FF0000");
90 auto color = QApplication::palette ().color (QPalette::Base);
91 color.setRedF (color.redF () / 2);
92 color.setBlueF (color.blueF () / 2);
93 ss.append (color.name ());
96 Ui_->Pattern_->setStyleSheet (ss);
102 if (Ui_->MatchCase_->checkState () == Qt::Checked)
104 if (Ui_->WrapAround_->checkState () == Qt::Checked)
134 Ui_->Pattern_->clear ();
virtual IPluginsManager * GetPluginsManager() const =0
Returns the application's plugin manager.
virtual IShortcutProxy * GetShortcutProxy() const =0
Returns the shortcut proxy used to communicate with the shortcut manager.
virtual QObject * GetPluginByID(const QByteArray &id) const =0
Returns plugin identified by its id.
Provides a "clear text" action for line edits.
void SetEscClearsEdit(bool clears)
Toggles whether Esc button clears the line edit.
A horizontal bar with typical widgets for text search.
~FindNotification() override
FindFlags GetFlags() const
Returns the current find flags except the direction.
void SetEscCloses(bool close)
Sets whether Esc closes the widget.
void FindNext()
Search for the next occurrence of the search text.
virtual void HandleNext(const QString &text, FindFlags flags)=0
Called each time the user requests a search.
void SetText(const QString &text)
Sets the text in the find field.
void Clear()
Clears the text in the find field.
FindNotification(const ICoreProxy_ptr &proxy, QWidget *near)
Creates the search widget in parent layout of near.
void SetSuccessful(bool successful)
Updates the widget to show whether the search has been successful.
QString GetText() const
Returns the currently entered text in the find field.
void FindPrevious()
Search for the previous occurrence of the search text.
A horizontal widget embedding into the parent layout of the passed parent widget.
void CreateShortcuts(const QList< QKeySequence > &shortcuts, const std::function< void()> &func, QWidget *parent)
Makes func invokable with shortcuts in seq.
std::shared_ptr< ICoreProxy > ICoreProxy_ptr