Wireshark 4.7.2
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
filter_edit.h
Go to the documentation of this file.
1
9
10#ifndef FILTER_EDIT_H
11#define FILTER_EDIT_H
12
13#include <QLineEdit>
14
15class FilterValidator;
16class FilterCompleter;
17class QTimer;
18
38class FilterEdit : public QLineEdit
39{
40 Q_OBJECT
42 Q_PROPERTY(QString syntaxState READ syntaxStateName)
43
44public:
56 Q_ENUM(SyntaxState)
57
58 explicit FilterEdit(QWidget *parent = nullptr);
59
61 SyntaxState state() const { return state_; }
62
64 QString syntaxStateName() const;
65
75
77 FilterValidator *validator() const { return validator_; }
78
84
86 FilterCompleter *completer() const { return completer_; }
87
89 QString lastError() const;
90
92 QString lastErrorFull() const;
93
95 QString deprecatedToken() const;
96
97public slots:
102 void insertFilter(const QString &filter);
103
104signals:
107
108protected:
114
122 void validateNow();
123
124private:
125 FilterValidator *validator_;
126 FilterCompleter *completer_;
127 SyntaxState state_;
128 QTimer *debounce_;
129
130private slots:
132 void onTextChanged();
133};
134
135#endif // FILTER_EDIT_H
QCompleter base for filter expressions, attachable to any QLineEdit.
Definition filter_completer.h:33
QLineEdit with validation-state tinting plus an injected filter validator and completer.
Definition filter_edit.h:39
QString lastErrorFull() const
Full, location-annotated error message, or empty.
Definition filter_edit.cpp:88
void setState(SyntaxState state)
Sets the state, re-polishes the style for the new QSS property, and emits syntaxStateChanged() if it ...
Definition filter_edit.cpp:123
FilterValidator * validator() const
The installed filter validator, or nullptr.
Definition filter_edit.h:77
QString syntaxStateName() const
Lowercase state name used for QSS property matching.
Definition filter_edit.cpp:44
void syntaxStateChanged(FilterEdit::SyntaxState state)
Emitted whenever the syntax state changes.
SyntaxState
Visual/semantic state of the current text, mapped from the validator.
Definition filter_edit.h:48
@ Deprecated
Definition filter_edit.h:53
@ Valid
Definition filter_edit.h:54
@ Invalid
Definition filter_edit.h:52
@ Intermediate
Definition filter_edit.h:51
@ Empty
Definition filter_edit.h:49
@ Busy
Definition filter_edit.h:50
SyntaxState state() const
Current syntax state.
Definition filter_edit.h:61
void setValidator(FilterValidator *validator)
Installs the filter validator. Widget-owned (deleted with the widget, and replaces any previous valid...
Definition filter_edit.cpp:57
void validateNow()
Runs the validator against the current text and updates the state.
Definition filter_edit.cpp:174
void insertFilter(const QString &filter)
Inserts filter at the cursor, padding with spaces as needed to keep the expression well-formed....
Definition filter_edit.cpp:98
QString syntaxState
Definition filter_edit.h:42
QString lastError() const
Short error message from the last validation, or empty.
Definition filter_edit.cpp:83
FilterCompleter * completer() const
The installed filter completer, or nullptr.
Definition filter_edit.h:86
QString deprecatedToken() const
Deprecated token from the last validation, or empty.
Definition filter_edit.cpp:93
void setCompleter(FilterCompleter *completer)
Installs the filter completer. Widget-owned, and also set as the QLineEdit completer so the native ty...
Definition filter_edit.cpp:68
Abstract QValidator for filter expressions, attachable to any QLineEdit.
Definition filter_validator.h:32