|
Wireshark 4.7.2
The Wireshark network protocol analyzer
|
FilterEdit plus the in-line action set, menus and history/bookmark wiring shared by the display- and capture-filter entries. More...
#include <filter_expression_edit.h>
Signals | |
| void | applied (const QString &expression) |
| The current expression was applied (action, or Enter). | |
| void | textChangedExpr (const QString &expression) |
| The expression text changed (distinct from QLineEdit::textChanged). | |
| void | validityChanged (bool valid) |
| Convenience: emitted with (state == Valid || state == Deprecated). | |
| void | cleared () |
| The clear action was triggered (distinct from typing to empty). | |
| void | saveBookmarkRequested (const QString &expression) |
| "Save current" chosen in the bookmark menu. | |
| void | removeBookmarkRequested (const QString &expression) |
| "Remove current" chosen in the bookmark menu. | |
| void | manageBookmarksRequested () |
| "Manage" chosen in the bookmark menu. | |
| void | preferencesRequested () |
| "Preferences" chosen in the bookmark menu. | |
| Signals inherited from FilterEdit | |
| void | syntaxStateChanged (FilterEdit::SyntaxState state) |
| Emitted whenever the syntax state changes. | |
Public Member Functions | |
| FilterExpressionEdit (QWidget *parent=nullptr) | |
| void | setHistoryModel (FilterHistoryModel *model) |
| Sets the recent-history model. Caller-owned: the widget keeps a non-owning reference and never deletes it. The history action and merged completion source pick it up. | |
| FilterHistoryModel * | historyModel () const |
| The injected history model, or nullptr. | |
| void | setBookmarkModel (BookmarkModel *model) |
| Sets the bookmark model. Widget-owned: deleted with the widget and replacing any previous model. Enables the bookmark action and menu. | |
| BookmarkModel * | bookmarkModel () const |
| The bookmark model, or nullptr. | |
| void | setApplyActionVisible (bool visible) |
| Shows or hides the apply (→) action, selecting explicit- vs implicit-apply mode. Hidden by default. | |
| bool | isApplyActionVisible () const |
| True when the apply action is present (explicit-apply mode). | |
| void | setPreferencesActionVisible (bool visible) |
| Shows or hides the bookmark menu's "preferences" item. Filter types without a relevant preferences pane (e.g. capture) hide it. | |
| 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 text is already a saved bookmark. Leaves supply both (same SVG, different theme token); the base swaps between them as the text matches a bookmark. | |
| 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 across filter types; only the wording differs, so leaves provide it here. | |
| QConcatenateTablesProxyModel * | completionModel () const |
| The merged history+bookmark model that backs typeahead completion. Owned by the widget; references (does not own) its sources. Leaves point their FilterCompleter at this. | |
| void | setButtonsLeftAligned (bool left) |
| Left-aligns the inline buttons (all clustered after the bookmark, with the text to their right) instead of right-anchoring the trailing trio. Persisted in recent.gui_geometry_leftalign_actions, so display and capture both honour the saved preference. | |
| bool | buttonsLeftAligned () const |
| True when the inline buttons are left-aligned. | |
| Public Member Functions inherited from FilterEdit | |
| FilterEdit (QWidget *parent=nullptr) | |
| SyntaxState | state () const |
| Current syntax state. | |
| QString | syntaxStateName () const |
| Lowercase state name used for QSS property matching. | |
| void | setValidator (FilterValidator *validator) |
| Installs the filter validator. Widget-owned (deleted with the widget, and replaces any previous validator). | |
| FilterValidator * | validator () const |
| The installed filter validator, or nullptr. | |
| void | setCompleter (FilterCompleter *completer) |
| Installs the filter completer. Widget-owned, and also set as the QLineEdit completer so the native typeahead popup works. | |
| FilterCompleter * | completer () const |
| The installed filter completer, or nullptr. | |
| QString | lastError () const |
| Short error message from the last validation, or empty. | |
| QString | lastErrorFull () const |
| Full, location-annotated error message, or empty. | |
| QString | deprecatedToken () const |
| Deprecated token from the last validation, or empty. | |
Protected Member Functions | |
| void | applyExpression () |
| Validates the final text and, if applyable, emits applied() and records the expression to history. No-op when empty or Invalid. | |
| void | paintEvent (QPaintEvent *event) override |
| Paints the field, then the bookmark/apply zone dividers on top. | |
| Protected Member Functions inherited from FilterEdit | |
| void | setState (SyntaxState state) |
| Sets the state, re-polishes the style for the new QSS property, and emits syntaxStateChanged() if it changed. | |
| void | validateNow () |
| Runs the validator against the current text and updates the state. | |
Additional Inherited Members | |
| Public Types inherited from FilterEdit | |
| enum class | SyntaxState { Empty , Busy , Intermediate , Invalid , Deprecated , Valid } |
| Visual/semantic state of the current text, mapped from the validator. More... | |
| Public Slots inherited from FilterEdit | |
| void | insertFilter (const QString &filter) |
Inserts filter at the cursor, padding with spaces as needed to keep the expression well-formed. Replaces a current selection. | |
| Properties inherited from FilterEdit | |
| QString | syntaxState |
FilterEdit plus the in-line action set, menus and history/bookmark wiring shared by the display- and capture-filter entries.
Sub-controls are AdaptiveToolButton children placed by a QHBoxLayout inside the field (bookmark | text | clear apply history). Each button hugs its glyph and tracks the application zoom; the layout reflows them on resize, and updateInlineMargins() reserves matching text margins so the text never runs under a button. Reserving via text margins also feeds QLineEdit's sizeHint, so the toolbar cannot compress the field under its neighbours. The only painting we add is a pair of thin vertical dividers (paintEvent) that fence the leading bookmark and trailing apply zones off from the text, matching the design mockup.
Buttons, in layout order:
The base emits generic, domain-neutral signals; the CaptureFilterEntry (and the planned display-filter leaf) translate them to their existing vocabularies.