| Wireshark 4.7.3 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
15 class FilterValidator;
16 class FilterCompleter;
17 class QTimer;
18
38 class FilterEdit : public QLineEdit
39{
40 Q_OBJECT
42 Q_PROPERTY(QString syntaxState READ syntaxStateName)
43
44 public:
48 enum class SyntaxState {
49 Empty,
50 Busy,
51 Intermediate,
52 Invalid,
53 Deprecated,
54 Valid
55 };
56 Q_ENUM(SyntaxState)
57
58 explicit FilterEdit(QWidget *parent = nullptr);
59
61 SyntaxState state() const { return state_; }
62
64 QString syntaxStateName() const;
65
74 void setValidator(FilterValidator *validator);
75
77 FilterValidator *validator() const { return validator_; }
78
83 void setCompleter(FilterCompleter *completer);
84
86 FilterCompleter *completer() const { return completer_; }
87
89 QString lastError() const;
90
92 QString lastErrorFull() const;
93
95 QString deprecatedToken() const;
96
97 public slots:
102 void insertFilter(const QString &filter);
103
104signals:
106 void syntaxStateChanged(FilterEdit::SyntaxState state);
107
108 protected:
113 void setState(SyntaxState state);
114
115 void paintEvent(QPaintEvent *event) override;
116
124 void validateNow();
125
126 private:
127 FilterValidator *validator_;
128 FilterCompleter *completer_;
129 SyntaxState state_;
130 QTimer *debounce_;
131
132 private slots:
134 void onTextChanged();
135};
136
137#endif // FILTER_EDIT_H
FilterCompleter
QCompleter base for filter expressions, attachable to any QLineEdit.
Definition filter_completer.h:33
FilterEdit
QLineEdit with validation-state tinting plus an injected filter validator and completer.
Definition filter_edit.h:39
FilterEdit::lastErrorFull
QString lastErrorFull() const
Full, location-annotated error message, or empty.
Definition filter_edit.cpp:91
FilterEdit::setState
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:126
FilterEdit::validator
FilterValidator * validator() const
The installed filter validator, or nullptr.
Definition filter_edit.h:77
FilterEdit::syntaxStateName
QString syntaxStateName() const
Lowercase state name used for QSS property matching.
Definition filter_edit.cpp:47
FilterEdit::syntaxStateChanged
void syntaxStateChanged(FilterEdit::SyntaxState state)
Emitted whenever the syntax state changes.
FilterEdit::SyntaxState
SyntaxState
Visual/semantic state of the current text, mapped from the validator.
Definition filter_edit.h:48
FilterEdit::SyntaxState::Deprecated
@ Deprecated
Definition filter_edit.h:53
FilterEdit::SyntaxState::Valid
@ Valid
Definition filter_edit.h:54
FilterEdit::SyntaxState::Invalid
@ Invalid
Definition filter_edit.h:52
FilterEdit::SyntaxState::Intermediate
@ Intermediate
Definition filter_edit.h:51
FilterEdit::SyntaxState::Empty
@ Empty
Definition filter_edit.h:49
FilterEdit::SyntaxState::Busy
@ Busy
Definition filter_edit.h:50
FilterEdit::state
SyntaxState state() const
Current syntax state.
Definition filter_edit.h:61
FilterEdit::setValidator
void setValidator(FilterValidator *validator)
Installs the filter validator. Widget-owned (deleted with the widget, and replaces any previous valid...
Definition filter_edit.cpp:60
FilterEdit::validateNow
void validateNow()
Runs the validator against the current text and updates the state.
Definition filter_edit.cpp:177
FilterEdit::insertFilter
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:101
FilterEdit::syntaxState
QString syntaxState
Definition filter_edit.h:42
FilterEdit::lastError
QString lastError() const
Short error message from the last validation, or empty.
Definition filter_edit.cpp:86
FilterEdit::completer
FilterCompleter * completer() const
The installed filter completer, or nullptr.
Definition filter_edit.h:86
FilterEdit::deprecatedToken
QString deprecatedToken() const
Deprecated token from the last validation, or empty.
Definition filter_edit.cpp:96
FilterEdit::setCompleter
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:71
FilterValidator
Abstract QValidator for filter expressions, attachable to any QLineEdit.
Definition filter_validator.h:32