-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystemcommondwidget.h
153 lines (119 loc) · 4.71 KB
/
systemcommondwidget.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#ifndef SYSTEMCOMMONDWIDGET_H
#define SYSTEMCOMMONDWIDGET_H
#include <QWidget>
#include <QPushButton>
#include <QGridLayout>
#include <QLabel>
#include <QMouseEvent>
#include <QResizeEvent>
#include <QStyle>
#include <QObject>
#include <QDebug>
#include <QObject>
#include <QStackedWidget>
#include <QToolButton>
#include "globalObserver.h"
#include <QMenu>
#include <QWidgetAction>
#include <QLabel>
#include <QComboBox>
#include <QLineEdit>
#include <QPushButton>
#include <QSpinBox>
#include <QDoubleSpinBox>
#include "DMMM.h"
#include <QtLocation>
#include <QMessageBox>
#include <QDockWidget>
#include <QGraphicsView>
#include <QGraphicsScene>
#include "svggraphicswidgetitem.h"
#include "svgbuttonitem.h"
#include "svgborderitem.h"
#include "C_MotorWidget.h"
#include "C_TakeoffWidget.h"
#include "C_LandWidget.h"
#include "C_WaypointWidget.h"
#include "C_RoutesButtonWidget.h"
#include "C_SetModeWidget.h"
#include "P_SetModeWidget.h"
#include "P_PreAction.h"
#include "P_RTL.h"
#include "P_Takeoff.h"
#include "P_Waypoint.h"
#include "P_LandWidget.h"
//菜单栏指令界面容器
class SystemCommondWidgetContainer : public QStackedWidget{
Q_OBJECT
public:
SystemCommondWidgetContainer(QWidget *parent = nullptr);
void addCommondWidget(QString name,QWidget *widget);
void ClearCommondWidget();
bool widgetIsExist(QString name);
private:
QMap<QString,QWidget *> widgetMap;
public slots:
void chooseWidgetChangeSlot(QString widgetName);
};
//菜单栏按键容器
class SystemMenuButtonContainer : public QWidget{
Q_OBJECT
public:
SystemMenuButtonContainer(QWidget *parent = nullptr);
void addMenuButton(QString name,QString buttnText,QIcon &ico,QString buttonObjectName = "SystemMenuButtonContainer"); //默认clicked信号触发后发出buttonPressedSignal信号
void addMenuButton(QString name,QString buttnText,QString signalName,QIcon& ico,QString buttonObjectName = "SystemMenuButtonContainer"); //默认clicked信号触发后发出buttonPressedSignal信号
void ClearMenuButton();
bool buttonIsExist(QString name);
private:
QHBoxLayout *widgetLayout = nullptr;
QMap<QString,QToolButton *>buttonMap;
private:
void initWidget();
public:
signals:
void buttonPressedSignal(QString name);
};
class SystemMenuWidget : public QWidget{
Q_OBJECT
public:
SystemMenuWidget(QWidget *parent = nullptr);
void addSystemMenu(QString buttonName,QString buttonText,QWidget *widget,QIcon ico); //添加一个按钮,绑定一个界面
void addSystemMenu(QString buttonName,QString buttonText,QString signalName,QIcon ico); //添加一个按钮,绑定一个信号
private:
SystemMenuButtonContainer *buttonContainer = nullptr; //按键容器
SystemCommondWidgetContainer *commondContainer = nullptr; //指令界面容器
QGraphicsScene *comondScene = nullptr;
QGraphicsView *commondView = nullptr;
QGraphicsScene *buttonScene = nullptr;
QGraphicsView *buttonView = nullptr;
SvgButtonItem *buttonViewButton = nullptr;
SvgButtonItem *commondViewButton = nullptr;
SvgBorderItem *buttonViewBorder = nullptr;
SvgBorderItem *commondViewBorder = nullptr;
SvgGraphicsWidgetItem *buttonViewWidget = nullptr;
SvgGraphicsWidgetItem *commondViewWidget = nullptr;
QGridLayout *widgetLayout = nullptr;
// 多旋翼
C_MotorUnlockWidget *C_Widget_motorUnlock = nullptr;
C_TakeoffMenuWidget *C_Widget_takeoffMenu = nullptr;
C_LandWidget *C_Widget_Land = nullptr;
C_WaypointWidget *C_Widget_waypoint = nullptr;
C_RoutesButtonWidget *C_Widget_routesButton = nullptr;
C_SetModeWidget *C_Widget_SetModeWidget = nullptr;
// 固定翼
P_SetModeWidget *P_Widget_SetModeWidget = nullptr;
WidgetPreAction *P_Widget_preaction = nullptr;
P_CMD_RTL *P_Widget_RTL = nullptr;
P_CMD_Takeoff *P_Widget_Takeoff = nullptr;
P_CMD_Waypoint *P_Widget_Waypoint = nullptr;
P_LandWidget *P_Widget_Land = nullptr;
private:
void widgetInit();
void connectSignalAnsSlot();
void AddCopterWidget();
void AddPlaneWidget();
private slots:
void buttonPressedSlot(QString name);
void handle_DMMM_event(int ev, int linkid);
};
#endif // SYSTEMCOMMONDWIDGET_H