Wireshark 4.7.2
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
DisplayFilterEntry Class Reference

Display-filter entry: the FilterExpressionEdit leaf for dfilters. More...

#include <display_filter_entry.h>

Inheritance diagram for DisplayFilterEntry:
FilterExpressionEdit FilterEdit

Public Slots

void recheck ()
 Re-validates the current text (e.g. on preferences change).
void displayFilterSuccess (bool success)
 Reflects whether the last applied filter succeeded; keeps the apply action disabled while the field already matches the active filter.
void setDisplayFilter (QString filter)
 Sets the field text and focuses it (programmatic filter entry).
void applyDisplayFilter ()
 Applies the current expression (explicit apply).
bool checkDisplayFilter ()
 Validates the current expression.
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.

Signals

void pushFilterSyntaxStatus (const QString &msg)
 Push a filter-syntax message to the status bar.
void popFilterSyntaxStatus ()
 Pop the filter-syntax message from the status bar.
void filterPackets (QString new_filter, bool force)
 Request applying new_filter to the packet list.
void showPreferencesDialog (QString pane_name)
 Request showing a preferences pane.
Signals inherited from FilterExpressionEdit
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

 DisplayFilterEntry (QWidget *parent=nullptr)
Public Member Functions inherited from FilterExpressionEdit
 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.
FilterHistoryModelhistoryModel () 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.
BookmarkModelbookmarkModel () 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).
FilterValidatorvalidator () 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.
FilterCompletercompleter () 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 dragEnterEvent (QDragEnterEvent *event) override
void dragMoveEvent (QDragMoveEvent *event) override
void dropEvent (QDropEvent *event) override
void contextMenuEvent (QContextMenuEvent *event) override
Protected Member Functions inherited from FilterExpressionEdit
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...
Properties inherited from FilterEdit
QString syntaxState

Detailed Description

Display-filter entry: the FilterExpressionEdit leaf for dfilters.

Wires the display validator/completer/history/bookmark backends, runs in explicit-apply mode (Enter or the apply action commits), and translates the base's generic signals to the display-filter vocabulary (filterPackets / showPreferencesDialog) while driving the main-window status bar directly.

Adds the display-only affordances the capture leaf does not need: drag-and-drop of display-filter and toolbar mime data, and a context-menu entry for the Display Filter Expression builder.

This replaces the DisplayFilterCombo + old DisplayFilterEdit on the main toolbar. The old SyntaxLineEdit-based DisplayFilterEdit still exists for the remaining read-filter / custom-column sites until those are migrated.

Member Function Documentation

◆ checkDisplayFilter

bool DisplayFilterEntry::checkDisplayFilter ( )
slot

Validates the current expression.

Returns
false when the syntax is Invalid, true otherwise.

The documentation for this class was generated from the following files: