Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
apply_line_edit.h
Go to the documentation of this file.
1
9
10#ifndef UI_QT_APPLY_LINE_EDIT_H_
11#define UI_QT_APPLY_LINE_EDIT_H_
12
13#include <QLineEdit>
14#include <QString>
15#include <QToolButton>
16
20class ApplyLineEdit : public QLineEdit
21{
22 Q_OBJECT
23
24public:
30 explicit ApplyLineEdit(QString linePlaceholderText, QWidget *parent = 0);
31
34
36 Q_PROPERTY(QString regex READ regex WRITE setRegEx)
37
38
39 Q_PROPERTY(bool emptyAllowed READ emptyAllowed WRITE setEmptyAllowed)
40
45 QString regex();
46
51 void setRegEx(QString regex);
52
58
65
66signals:
71
72protected:
77 void resizeEvent(QResizeEvent *event) override;
78
79private:
80 QString regex_;
81 bool emptyAllowed_;
82 QToolButton *apply_button_;
83
91 bool isValidText(QString &text, bool ignoreEmptyCheck = false);
92
97 void handleValidation(QString newText);
98
99private slots:
104 void onTextEdited(const QString &text);
105
110 void onTextChanged(const QString &text);
111
115 void onSubmitContent();
116};
117
118#endif /* UI_QT_APPLY_LINE_EDIT_H_ */
bool emptyAllowed
Whether an empty string is considered a valid value.
Definition apply_line_edit.h:39
~ApplyLineEdit()
Destroy the ApplyLineEdit and its embedded apply button.
Definition apply_line_edit.cpp:71
void textApplied()
Emitted when the user applies the current (valid) text.
void resizeEvent(QResizeEvent *event) override
Reposition the embedded apply button when the widget is resized.
Definition apply_line_edit.cpp:146
void setRegEx(QString regex)
Set the validation regex pattern.
Definition apply_line_edit.cpp:73
void setEmptyAllowed(bool emptyAllowed)
Set whether empty input is accepted as valid.
Definition apply_line_edit.cpp:83
QString regex
The regular expression pattern used to validate input text.
Definition apply_line_edit.h:36
ApplyLineEdit(QString linePlaceholderText, QWidget *parent=0)
Construct an ApplyLineEdit.
Definition apply_line_edit.cpp:21