36 #include "ui_findnotification.h" 44 , Ui_ {
new Ui::FindNotification }
45 , EscShortcut_ {
new QShortcut { Qt::Key_Escape,
this, SLOT (
reject ()) } }
49 setFocusProxy (Ui_->Pattern_);
51 EscShortcut_->setContext (Qt::WidgetWithChildrenShortcut);
54 addon->SetEscClearsEdit (
false);
56 const auto coreInstance = proxy->GetPluginsManager ()->
57 GetPluginByID (
"org.LeechCraft.CoreInstance");
58 const auto scProxy = proxy->GetShortcutProxy ();
80 EscShortcut_->setEnabled (close);
85 Ui_->Pattern_->setText (text);
90 return Ui_->Pattern_->text ();
95 auto ss = QString {
"QLineEdit {" 96 "background-color:rgb(" };
98 ss.append (
"255,0,0");
101 auto color = QApplication::palette ().color (QPalette::Base);
102 color.setRedF (color.redF () / 2);
103 color.setBlueF (color.blueF () / 2);
105 int r = 0, g = 0, b = 0;
106 color.getRgb (&r, &g, &b);
108 ss.append (QString (
"%1,%2,%3")
114 Ui_->Pattern_->setStyleSheet (ss);
120 if (Ui_->MatchCase_->checkState () == Qt::Checked)
122 if (Ui_->WrapAround_->checkState () == Qt::Checked)
152 Ui_->Pattern_->clear ();
156 void FindNotification::on_Pattern__textChanged (
const QString& newText)
158 Ui_->FindButton_->setEnabled (!newText.isEmpty ());
161 void FindNotification::on_FindButton__released ()
164 if (Ui_->SearchBackwards_->checkState () == Qt::Checked)
void SetText(const QString &text)
Sets the text in the find field.
void findPrevious()
Search for the previous occurrence of the search text.
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 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
virtual void handleNext(const QString &text, FindFlags flags)=0
Called each time the user requests a search.
void findNext()
Search for the next occurrence of the search text.
FindFlags GetFlags() const
Returns the current find flags except the direction.
A horizontal widget embedding into the parent layout of the passed parent widget. ...
void SetEscCloses(bool close)
Sets whether Esc closes the widget.
Provides a "clear text" action for line edits.
FindNotification(ICoreProxy_ptr proxy, QWidget *near)
Creates the search widget in parent layout of near.
void clear()
Clears the text in the find field.