Wireshark  4.3.0
The Wireshark network protocol analyzer
label_stack.h
Go to the documentation of this file.
1 
10 #ifndef LABEL_STACK_H
11 #define LABEL_STACK_H
12 
13 #include <QLabel>
14 #include <QStack>
15 #include <QElapsedTimer>
16 #include <QTimer>
17 
18 class LabelStack : public QLabel
19 {
20  Q_OBJECT
21 public:
22  explicit LabelStack(QWidget *parent = 0);
23  void setTemporaryContext(const int ctx);
24  void pushText(const QString &text, int ctx, const QString &tooltip = QString());
25  void setShrinkable(bool shrinkable = true);
26 
27 protected:
28  void mousePressEvent(QMouseEvent *event);
29  void mouseReleaseEvent(QMouseEvent *event);
30  void mouseDoubleClickEvent(QMouseEvent *event);
31  void mouseMoveEvent(QMouseEvent *event);
32  void contextMenuEvent(QContextMenuEvent *event);
33  void paintEvent (QPaintEvent *event);
34 
35 private:
36  typedef struct _StackItem {
37  QString text;
38  QString tooltip;
39  int ctx;
40  } StackItem;
41 
42  int temporary_ctx_;
43  QList<StackItem> labels_;
44  bool shrinkable_;
45  QElapsedTimer temporary_epoch_;
46  QTimer temporary_timer_;
47 
48  void fillLabel();
49 
50 signals:
51  void toggleTemporaryFlash(bool enable);
52  void mousePressedAt(const QPoint &global_pos, Qt::MouseButton button);
53 
54 public slots:
55  void popText(int ctx);
56 
57 private slots:
58  void updateTemporaryStatus();
59 };
60 
61 #endif // LABEL_STACK_H
Definition: label_stack.h:19