| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
display_filter_edit.h
Go to the documentation of this file.
1
9
10#ifndef DISPLAYFILTEREDIT_H
11#define DISPLAYFILTEREDIT_H
12
13#include <QDrag>
14#include <QActionGroup>
15#include <QPointer>
16
17#include <ui/qt/widgets/syntax_line_edit.h>
18
19 class QEvent;
20 class StockIconToolButton;
21
25 typedef enum {
26 DisplayFilterToApply,
27 DisplayFilterToEnter,
28 ReadFilterToApply,
29 CustomColumnToEnter,
30} DisplayFilterEditType;
31
35 class DisplayFilterEdit : public SyntaxLineEdit
36{
37 Q_OBJECT
38 public:
44 explicit DisplayFilterEdit(QWidget *parent = 0, DisplayFilterEditType type = DisplayFilterToEnter);
45
50 void setType(DisplayFilterEditType type);
51
52 protected:
57 void paintEvent(QPaintEvent *evt) override;
58
62 void resizeEvent(QResizeEvent *) override;
63
68 void keyPressEvent(QKeyEvent *event) override { completionKeyPressEvent(event); }
69
74 void focusInEvent(QFocusEvent *event) override { completionFocusInEvent(event); }
75
80 void focusOutEvent(QFocusEvent *event) override;
81
86 virtual void dragEnterEvent(QDragEnterEvent *event) override;
87
92 virtual void dragMoveEvent(QDragMoveEvent *event) override;
93
98 virtual void dropEvent(QDropEvent *event) override;
99
104 virtual void contextMenuEvent(QContextMenuEvent *menu) override;
105
106 public slots:
111 bool checkFilter();
112
116 void updateBookmarkMenu();
117
121 void applyDisplayFilter();
122
127 void displayFilterSuccess(bool success);
128
133 void setStyleSheet(const QString &style_sheet);
134
135 private slots:
140 void checkFilter(const QString &filter_text);
141
145 void clearFilter();
146
151 void changeEvent(QEvent* event) override;
152
156 void displayFilterExpression();
157
161 void saveFilter();
162
166 void removeFilter();
167
171 void showFilters();
172
176 void showExpressionPrefs();
177
181 void applyOrPrepareFilter();
182
186 void triggerAlignementAction();
187
191 void connectToMainWindow();
192
193 private:
195 DisplayFilterEditType type_;
196
198 QString placeholder_text_;
199
201 QAction *save_action_;
202
204 QAction *remove_action_;
205
207 QActionGroup * actions_;
208
210 QPointer<StockIconToolButton> bookmark_button_;
211
213 QPointer<StockIconToolButton> clear_button_;
214
216 QPointer<StockIconToolButton> apply_button_;
217
219 bool leftAlignActions_;
220
222 QString last_applied_;
223
225 QString filter_word_preamble_;
226
228 bool autocomplete_accepts_field_;
229
231 QString style_sheet_;
232
236 void setDefaultPlaceholderText();
237
243 void buildCompletionList(const QString &field_word, const QString &preamble) override;
244
251 void createFilterTextDropMenu(QDropEvent *event, bool prepare, QString filterText = QString());
252
256 void alignActionButtons();
257
261 void updateClearButton();
262
263signals:
268 void pushFilterSyntaxStatus(const QString& msg);
269
273 void popFilterSyntaxStatus();
274
280 void filterPackets(QString new_filter, bool force);
281
286 void showPreferencesDialog(QString pane_name);
287
288};
289
290#endif // DISPLAYFILTEREDIT_H
DisplayFilterEdit::setType
void setType(DisplayFilterEditType type)
Sets the type of the display filter edit widget.
Definition display_filter_edit.cpp:97
DisplayFilterEdit::showPreferencesDialog
void showPreferencesDialog(QString pane_name)
Signal emitted to request displaying the preferences dialog.
DisplayFilterEdit::contextMenuEvent
virtual void contextMenuEvent(QContextMenuEvent *menu) override
Handles context menu events to display appropriate actions.
Definition display_filter_edit.cpp:160
DisplayFilterEdit::keyPressEvent
void keyPressEvent(QKeyEvent *event) override
Handles key press events and forwards them to the completion logic.
Definition display_filter_edit.h:68
DisplayFilterEdit::updateBookmarkMenu
void updateBookmarkMenu()
Updates the bookmark menu with current saved filters.
Definition display_filter_edit.cpp:456
DisplayFilterEdit::DisplayFilterEdit
DisplayFilterEdit(QWidget *parent=0, DisplayFilterEditType type=DisplayFilterToEnter)
Constructs a new DisplayFilterEdit widget.
Definition display_filter_edit.cpp:62
DisplayFilterEdit::dropEvent
virtual void dropEvent(QDropEvent *event) override
Handles drop events containing filter data.
Definition display_filter_edit.cpp:831
DisplayFilterEdit::checkFilter
bool checkFilter()
Validates the syntax of the current display filter.
Definition display_filter_edit.cpp:359
DisplayFilterEdit::setStyleSheet
void setStyleSheet(const QString &style_sheet)
Sets the widget's style sheet.
Definition display_filter_edit.cpp:643
DisplayFilterEdit::resizeEvent
void resizeEvent(QResizeEvent *) override
Handles resize events for the widget.
Definition display_filter_edit.cpp:345
DisplayFilterEdit::dragMoveEvent
virtual void dragMoveEvent(QDragMoveEvent *event) override
Handles drag move events for visual feedback.
Definition display_filter_edit.cpp:812
DisplayFilterEdit::popFilterSyntaxStatus
void popFilterSyntaxStatus()
Signal emitted to pop (remove) the last filter syntax status message.
DisplayFilterEdit::applyDisplayFilter
void applyDisplayFilter()
Applies the currently entered display filter.
Definition display_filter_edit.cpp:659
DisplayFilterEdit::focusOutEvent
void focusOutEvent(QFocusEvent *event) override
Handles focus out events for the widget.
Definition display_filter_edit.cpp:350
DisplayFilterEdit::dragEnterEvent
virtual void dragEnterEvent(QDragEnterEvent *event) override
Handles drag enter events to accept valid drops.
Definition display_filter_edit.cpp:793
DisplayFilterEdit::focusInEvent
void focusInEvent(QFocusEvent *event) override
Handles focus in events and forwards them to the completion logic.
Definition display_filter_edit.h:74
DisplayFilterEdit::filterPackets
void filterPackets(QString new_filter, bool force)
Signal emitted to request packet filtering with a new filter string.
DisplayFilterEdit::paintEvent
void paintEvent(QPaintEvent *evt) override
Handles paint events for the widget.
Definition display_filter_edit.cpp:293
DisplayFilterEdit::pushFilterSyntaxStatus
void pushFilterSyntaxStatus(const QString &msg)
Signal emitted to push a status message regarding filter syntax.
DisplayFilterEdit::displayFilterSuccess
void displayFilterSuccess(bool success)
Updates the UI state indicating whether the display filter was successfully applied.
Definition display_filter_edit.cpp:713
StockIconToolButton
A tool button that displays a stock icon.
Definition stock_icon_tool_button.h:19
SyntaxLineEdit::SyntaxLineEdit
SyntaxLineEdit(QWidget *parent=0)
Constructs the SyntaxLineEdit in the Empty state with no completer.
Definition syntax_line_edit.cpp:37
SyntaxLineEdit::completionKeyPressEvent
void completionKeyPressEvent(QKeyEvent *event)
Handles key press events while the completer popup is visible, forwarding navigation keys to the popu...
Definition syntax_line_edit.cpp:336
SyntaxLineEdit::completionFocusInEvent
void completionFocusInEvent(QFocusEvent *event)
Triggers a completion refresh when the widget gains focus.
Definition syntax_line_edit.cpp:384
SyntaxLineEdit::event
virtual bool event(QEvent *event) override
Intercepts Tab and other keys to trigger or dismiss the completer.
Definition syntax_line_edit.cpp:299
DisplayFilterEditType
DisplayFilterEditType
Specifies how a filter or column expression entered in the filter edit widget should be handled.
Definition display_filter_edit.h:25
ReadFilterToApply
@ ReadFilterToApply
Definition display_filter_edit.h:28
CustomColumnToEnter
@ CustomColumnToEnter
Definition display_filter_edit.h:29
DisplayFilterToApply
@ DisplayFilterToApply
Definition display_filter_edit.h:26
DisplayFilterToEnter
@ DisplayFilterToEnter
Definition display_filter_edit.h:27
syntax_line_edit.h