| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
detachable_tabwidget.h
1/* @file
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 DETACHABLE_TABWIDGET_H
11#define DETACHABLE_TABWIDGET_H
12
13#include <wireshark.h>
14
15#include <QTabWidget>
16#include <QDialog>
17#include <QEvent>
18#include <QCloseEvent>
19#include <QTabBar>
20#include <QPoint>
21#include <QCursor>
22
23 class DetachableTabWidget : public QTabWidget
24{
25 Q_OBJECT
26 public:
27 DetachableTabWidget(QWidget * parent = nullptr);
28
29 QString tabBasename() const;
30
31 protected:
32
33 void setTabBasename(QString newName);
34
35 protected slots:
36
37 virtual void moveTab(int from, int to);
38 virtual void detachTab(int tabIdx, QPoint pos);
39 virtual void attachTab(QWidget * content, QString name);
40
41 private:
42 QString _tabBasename;
43
44};
45
46 class ToolDialog : public QDialog
47{
48 Q_OBJECT
49 public:
50 explicit ToolDialog(QWidget * _contentWidget, QWidget * parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
51
52 protected:
53
54 virtual bool event(QEvent *event);
55 virtual void closeEvent(QCloseEvent *event);
56
57signals:
58 void onCloseSignal(QWidget * contentWidget, QString name);
59
60 private:
61 QWidget * _contentWidget;
62};
63
64 class DragDropTabBar : public QTabBar
65{
66 Q_OBJECT
67 public:
68 explicit DragDropTabBar(QWidget * parent);
69
70signals:
71 void onDetachTab(int tabIdx, QPoint pos);
72 void onMoveTab(int oldIdx, int newIdx);
73
74 protected:
75 virtual void mouseDoubleClickEvent(QMouseEvent *event);
76 virtual void mousePressEvent(QMouseEvent *event);
77 virtual void mouseMoveEvent(QMouseEvent *event);
78 virtual void dragEnterEvent(QDragEnterEvent *event);
79 virtual void dropEvent(QDropEvent *event);
80
81 private:
82 QPoint _dragStartPos;
83 QPoint _dragDropPos;
84 QCursor _mouseCursor;
85 bool _dragInitiated;
86
87};
88
89#endif // DETACHABLE_TABWIDGET_H
DetachableTabWidget
Definition detachable_tabwidget.h:24
DragDropTabBar
Definition detachable_tabwidget.h:65
ToolDialog
Definition detachable_tabwidget.h:47
ToolDialog::event
virtual bool event(QEvent *event)
Definition detachable_tabwidget.cpp:103