10#ifndef SYNTAX_LINE_EDIT_H
11#define SYNTAX_LINE_EDIT_H
16class QStringListModel;
30 Q_PROPERTY(
SyntaxState syntaxState READ syntaxState)
116 const QString &err_msg,
189 Q_UNUSED(field_word);
239 QString style_sheet_;
240 QString state_style_sheet_;
241 QString syntax_error_message_;
242 QString syntax_error_message_full_;
243 QString token_chars_;
244 bool completion_enabled_;
251 void insertFieldCompletion(
const QString &completion_text);
QString deprecatedToken()
Returns the deprecated token string when the state is Deprecated.
QPoint getTokenUnderCursor()
Returns the start position and length of the token under the cursor.
Definition syntax_line_edit.cpp:472
SyntaxLineEdit(QWidget *parent=0)
Constructs the SyntaxLineEdit in the Empty state with no completer.
Definition syntax_line_edit.cpp:38
static QString createSyntaxErrorMessageFull(const QString &filter, const QString &err_msg, qsizetype loc_start, size_t loc_length)
Builds a full syntax error message string combining the filter expression with a location-annotated e...
Definition syntax_line_edit.cpp:115
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:337
void completionFocusInEvent(QFocusEvent *event)
Triggers a completion refresh when the widget gains focus.
Definition syntax_line_edit.cpp:385
bool isComplexFilter(const QString &filter)
Returns true if filter contains operators or structure that make it too complex for token-level autoc...
Definition syntax_line_edit.cpp:284
bool checkDisplayFilter(QString filter)
Validates filter as a Wireshark display filter and updates the syntax state and error message accordi...
Definition syntax_line_edit.cpp:159
virtual void focusOutEvent(QFocusEvent *event) override
Hides the completer popup when the widget loses focus.
Definition syntax_line_edit.cpp:392
QStringList splitLineUnderCursor()
Splits the line at the cursor into the preamble and the current token.
Definition syntax_line_edit.cpp:492
QString syntaxErrorMessage()
Returns a short, human-readable description of the current syntax error.
Definition syntax_line_edit.cpp:105
void setSyntaxState(SyntaxState state=Empty)
Sets the syntax state and updates the widget's style sheet to reflect it.
Definition syntax_line_edit.cpp:77
void insertFilter(const QString &filter)
Inserts filter text at the cursor position, adding surrounding spaces where necessary to keep the exp...
Definition syntax_line_edit.cpp:141
virtual bool event(QEvent *event) override
Intercepts Tab and other keys to trigger or dismiss the completer.
Definition syntax_line_edit.cpp:300
QString syntaxErrorMessageFull()
Returns a full error message that includes the filter expression and the location of the error within...
Definition syntax_line_edit.cpp:110
QStringListModel * completion_model_
Definition syntax_line_edit.h:163
QString styleSheet() const
Returns the base style sheet, excluding any state-driven overrides.
Definition syntax_line_edit.cpp:132
QCompleter * completer_
Definition syntax_line_edit.h:162
void checkCustomColumn(QString fields)
Validates fields as a custom-column field expression and updates the syntax state.
Definition syntax_line_edit.cpp:230
SyntaxState
Visual and semantic state of the text currently in the editor.
Definition syntax_line_edit.h:42
@ Busy
Definition syntax_line_edit.h:44
@ Deprecated
Definition syntax_line_edit.h:46
@ Invalid
Definition syntax_line_edit.h:45
@ Valid
Definition syntax_line_edit.h:47
@ Empty
Definition syntax_line_edit.h:43
virtual void paintEvent(QPaintEvent *event) override
Paints the widget, overlaying a state-appropriate background colour.
Definition syntax_line_edit.cpp:405
void setCompletionTokenChars(const QString &token_chars)
Sets the characters that may appear in a completion token (e.g. letters, digits, underscores,...
Definition syntax_line_edit.h:171
QCompleter * completer() const
Returns the currently installed completer.
Definition syntax_line_edit.h:98
void checkFieldName(QString field)
Validates field as a protocol field name and updates the syntax state.
Definition syntax_line_edit.cpp:215
void setStyleSheet(const QString &style_sheet)
Sets the base style sheet; the state-driven style is composited on top.
Definition syntax_line_edit.cpp:136
void allowCompletion(bool enabled)
Enables or disables autocompletion without removing the completer.
Definition syntax_line_edit.cpp:72
virtual void buildCompletionList(const QString &field_word, const QString &preamble)
Builds the list of completion candidates based on the current token and filter context....
Definition syntax_line_edit.h:187
void checkInteger(QString number)
Validates number as a well-formed integer and updates the syntax state.
Definition syntax_line_edit.cpp:268
void setCompleter(QCompleter *c)
Installs a QCompleter for token-based autocompletion.
Definition syntax_line_edit.cpp:49