Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
apply_line_edit.h
Go to the documentation of this file.
1
10#ifndef UI_QT_APPLY_LINE_EDIT_H_
11#define UI_QT_APPLY_LINE_EDIT_H_
12
13#include <QLineEdit>
14#include <QString>
15
17
21class ApplyLineEdit : public QLineEdit
22{
23 Q_OBJECT
24
25public:
31 explicit ApplyLineEdit(QString linePlaceholderText, QWidget *parent = 0);
32
35
37 Q_PROPERTY(QString regex READ regex WRITE setRegEx)
38
39
40 Q_PROPERTY(bool emptyAllowed READ emptyAllowed WRITE setEmptyAllowed)
41
46 QString regex();
47
52 void setRegEx(QString regex);
53
59
66
67signals:
72
73protected:
78 void resizeEvent(QResizeEvent *event);
79
80private:
81 QString regex_;
82 bool emptyAllowed_;
83 StockIconToolButton *apply_button_;
92 bool isValidText(QString &text, bool ignoreEmptyCheck = false);
93
98 void handleValidation(QString newText);
99
100private slots:
105 void onTextEdited(const QString &text);
106
111 void onTextChanged(const QString &text);
112
116 void onSubmitContent();
117};
118
119#endif /* UI_QT_APPLY_LINE_EDIT_H_ */
A QLineEdit with an embedded apply button and optional regex validation.
Definition apply_line_edit.h:22
bool emptyAllowed
Whether an empty string is considered a valid value.
Definition apply_line_edit.h:40
~ApplyLineEdit()
Destroy the ApplyLineEdit and its embedded apply button.
Definition apply_line_edit.cpp:57
void textApplied()
Emitted when the user applies the current (valid) text.
void resizeEvent(QResizeEvent *event)
Reposition the embedded apply button when the widget is resized.
Definition apply_line_edit.cpp:132
void setRegEx(QString regex)
Set the validation regex pattern.
Definition apply_line_edit.cpp:59
void setEmptyAllowed(bool emptyAllowed)
Set whether empty input is accepted as valid.
Definition apply_line_edit.cpp:69
QString regex
The regular expression pattern used to validate input text.
Definition apply_line_edit.h:37
A tool button that displays a stock icon.
Definition stock_icon_tool_button.h:19