Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
apply_line_edit.h
1 /* apply_lineedit.h
2  *
3  * Wireshark - Network traffic analyzer
4  * By Gerald Combs <gerald@wireshark.org>
5  * Copyright 1998 Gerald Combs
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
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 
16 #include <ui/qt/widgets/stock_icon_tool_button.h>
17 
18 class ApplyLineEdit : public QLineEdit
19 {
20  Q_OBJECT
21 
22 public:
23  explicit ApplyLineEdit(QString linePlaceholderText, QWidget *parent = 0);
24  ~ApplyLineEdit();
25 
26  Q_PROPERTY(QString regex READ regex WRITE setRegEx)
27  Q_PROPERTY(bool emptyAllowed READ emptyAllowed WRITE setEmptyAllowed)
28 
29  QString regex();
30  void setRegEx(QString);
31 
32  bool emptyAllowed();
33  void setEmptyAllowed(bool);
34 
35 signals:
36  void textApplied();
37 
38 protected:
39  void resizeEvent(QResizeEvent *);
40 
41 private:
42 
43  QString regex_;
44  bool emptyAllowed_;
45 
46  StockIconToolButton *applyButton;
47 
48  bool isValidText(QString &, bool ignoreEmptyCheck = false);
49  void handleValidation(QString newText);
50 
51 private slots:
52  void onTextEdited(const QString &);
53  void onTextChanged(const QString &);
54  void onSubmitContent();
55 };
56 
57 #endif /* UI_QT_APPLY_LINE_EDIT_H_ */
58 
59 /*
60  * Editor modelines
61  *
62  * Local Variables:
63  * c-basic-offset: 4
64  * tab-width: 8
65  * indent-tabs-mode: nil
66  * End:
67  *
68  * ex: set shiftwidth=4 tabstop=8 expandtab:
69  * :indentSize=4:tabSize=8:noTabs=true:
70  */
Definition: apply_line_edit.h:18
Definition: stock_icon_tool_button.h:15