10#ifndef FILTER_EXPRESSION_EDIT_H
11#define FILTER_EXPRESSION_EDIT_H
23class QConcatenateTablesProxyModel;
54class FilterExpressionEdit :
public FilterEdit
59 explicit FilterExpressionEdit(QWidget *parent =
nullptr);
116 const QString &save_current,
117 const QString &remove_current,
118 const QString &manage,
119 const QString &preferences);
174 virtual void updateButtonTranslations();
175 virtual void updateTranslations();
178 void rebuildBookmarkEntries();
179 void populateHistoryMenu();
180 void updateClearVisible();
181 void updateApplyEnabled();
182 void updateRemoveEnabled();
183 void updateBookmarkState();
184 void updateInlineMargins();
185 void rebuildInlineLayout();
187 int inlineEdge()
const;
188 QMargins inlineMargins();
199 QHBoxLayout *inline_layout_;
201 QIcon normal_bookmark_icon_;
202 QIcon matching_bookmark_icon_;
204 QMenu *bookmark_menu_;
205 QMenu *history_menu_;
208 QAction *save_action_;
209 QAction *remove_action_;
210 QAction *manage_action_;
211 QAction *preferences_action_;
212 QAction *static_separator_;
213 QString saved_section_label_;
214 QList<QAction *> entry_actions_;
218 QConcatenateTablesProxyModel *completion_source_;
221 QString applied_expression_;
222 bool buttons_left_aligned_;
Abstract list model of saved ("bookmarked") filter expressions.
Definition bookmark_model.h:30
void changeEvent(QEvent *event) override
Event handler for changeEvents, e.g. QEvent::LanguageChange.
Definition filter_expression_edit.cpp:592
void setHistoryModel(FilterHistoryModel *model)
Sets the recent-history model. Caller-owned: the widget keeps a non-owning reference and never delete...
Definition filter_expression_edit.cpp:273
void paintEvent(QPaintEvent *event) override
Paints the field, then the bookmark/apply zone dividers on top.
Definition filter_expression_edit.cpp:617
QConcatenateTablesProxyModel * completionModel() const
The merged history+bookmark model that backs typeahead completion. Owned by the widget; references (d...
Definition filter_expression_edit.h:126
void manageBookmarksRequested()
"Manage" chosen in the bookmark menu.
void setApplyActionVisible(bool visible)
Shows or hides the apply (→) action, selecting explicit- vs implicit-apply mode. Hidden by default.
Definition filter_expression_edit.cpp:325
FilterHistoryModel * historyModel() const
The injected history model, or nullptr.
Definition filter_expression_edit.h:69
void setBookmarkModel(BookmarkModel *model)
Sets the bookmark model. Widget-owned: deleted with the widget and replacing any previous model....
Definition filter_expression_edit.cpp:292
void cleared()
The clear action was triggered (distinct from typing to empty).
BookmarkModel * bookmarkModel() const
The bookmark model, or nullptr.
Definition filter_expression_edit.h:78
void saveBookmarkRequested(const QString &expression)
"Save current" chosen in the bookmark menu.
void setAppliedExpression(const QString &expression)
Records the expression currently in effect. While the field text equals it, the apply action stays di...
Definition filter_expression_edit.cpp:466
void applyExpression()
Validates the final text and, if applyable, emits applied() and records the expression to history....
Definition filter_expression_edit.cpp:359
void setBookmarkIcon(const QIcon &normal, const QIcon &matching)
Sets the leading bookmark glyphs: normal in the per-filter colour and matching shown when the current...
Definition filter_expression_edit.cpp:333
bool isApplyActionVisible() const
True when the apply action is present (explicit-apply mode).
Definition filter_expression_edit.h:94
bool buttonsLeftAligned() const
True when the inline buttons are left-aligned.
Definition filter_expression_edit.h:137
bool event(QEvent *event) override
Re-syncs the inline insets once the style sheet has been applied.
Definition filter_expression_edit.cpp:607
void setBookmarkMenuLabels(const QString &saved_section, const QString &save_current, const QString &remove_current, const QString &manage, const QString &preferences)
Supplies the bookmark-menu label strings. Menu structure, behaviour and enablement are identical acro...
Definition filter_expression_edit.cpp:345
void applied(const QString &expression)
The current expression was applied (action, or Enter).
void setPreferencesActionVisible(bool visible)
Shows or hides the bookmark menu's "preferences" item. Filter types without a relevant preferences pa...
Definition filter_expression_edit.cpp:340
void validityChanged(bool valid)
Convenience: emitted with (state == Valid || state == Deprecated).
void removeBookmarkRequested(const QString &expression)
"Remove current" chosen in the bookmark menu.
void preferencesRequested()
"Preferences" chosen in the bookmark menu.
void textChangedExpr(const QString &expression)
The expression text changed (distinct from QLineEdit::textChanged).
void setButtonsLeftAligned(bool left)
Left-aligns the inline buttons (all clustered after the bookmark, with the text to their right) inste...
Definition filter_expression_edit.cpp:503
Abstract list model of recently applied filter expressions.
Definition filter_history_model.h:30