-
Notifications
You must be signed in to change notification settings - Fork 0
/
basedock.h
46 lines (32 loc) · 968 Bytes
/
basedock.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef BASEDOCK_H
#define BASEDOCK_H
#include <QDockWidget>
#include <QObject>
#include <QWidget>
#include <QAction>
#include <QMenu>
#include <QString>
//this category of widgets is not deleted after closing
//Base class for dock widgets in the peripheral screen
class BaseDock : public QDockWidget
{
Q_OBJECT
public:
explicit BaseDock(const QString& title,
QWidget* parent = nullptr,
Qt::WindowFlags flags = {}); //flags for window parameters
//returns the menu to display in menubar
QMenu* getMenu();
//Set parameter '_drawAsWindow' for opening widget as window
virtual Qt::DockWidgetArea getDefaultArea() const;
protected:
void drawAsWindow(bool);
void contextMenuEvent(QContextMenuEvent *event) override;
private slots:
void onTopLevelChanged(bool);
protected:
bool _drawAsWindow;
Qt::WindowFlags _flags;
QMenu *_menu;
};
#endif // BASEDOCK_H