Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
editor_color_dialog.h
1 /* editor_color_dialog.h
2  *
3  * Color dialog that can be used as an "inline editor" in a table
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11 
12 #ifndef EDITOR_COLOR_DIALOG_H_
13 #define EDITOR_COLOR_DIALOG_H_
14 
15 #include <QLineEdit>
16 #include <QPushButton>
17 #include <QModelIndex>
18 
19 class EditorColorDialog : public QLineEdit
20 {
21  Q_OBJECT
22 public:
23  EditorColorDialog(const QModelIndex& index, const QColor& initial, QWidget* parent = 0);
24 
25  QColor currentColor() { return current_; }
26  virtual void focusInEvent(QFocusEvent *event);
27  virtual void focusOutEvent(QFocusEvent *event);
28  virtual bool eventFilter(QObject *obj, QEvent *event);
29 
30 signals:
31  void acceptEdit(const QModelIndex& index);
32 
33 private slots:
34  void applyColor();
35 
36 protected:
37  void resizeEvent(QResizeEvent *);
38 
39  QPushButton* color_button_;
40  const QModelIndex index_; //saved index of table cell
41  QColor current_; //initial color in edit
42 };
43 
44 #endif /* EDITOR_COLOR_DIALOG_H_ */
45 
46 /*
47  * Editor modelines
48  *
49  * Local Variables:
50  * c-basic-offset: 4
51  * tab-width: 8
52  * indent-tabs-mode: nil
53  * End:
54  *
55  * ex: set shiftwidth=4 tabstop=8 expandtab:
56  * :indentSize=4:tabSize=8:noTabs=true:
57  */
Definition: editor_color_dialog.h:19