15#include "ui_findnotification.h"
28 EscShortcut_->setContext (Qt::WidgetWithChildrenShortcut);
31 addon->SetEscClearsEdit (
false);
33 const auto coreInstance =
proxy->GetPluginsManager ()->GetPluginByID (
"org.LeechCraft.CoreInstance");
49 &QLineEdit::textChanged,
50 [
this] (
const auto&
str) { Ui_->FindButton_->setEnabled (!str.isEmpty ()); });
52 &QPushButton::released,
55 auto flags = GetFlags ();
56 if (Ui_->SearchBackwards_->checkState () == Qt::Checked)
57 flags |= FindBackwards;
58 HandleNext (Ui_->Pattern_->text (), flags);
61 &QPushButton::released,
70 EscShortcut_->setEnabled (
close);
75 Ui_->Pattern_->setText (text);
80 return Ui_->Pattern_->text ();
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 ();
Provides a "clear text" action for line edits.
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
Container< T > Filter(const Container< T > &c, F f)