修正状态,添加指令

This commit is contained in:
hm
2020-10-10 12:12:30 +08:00
parent 386bfb2842
commit e3c98c6259
20 changed files with 1368 additions and 910 deletions
+71
View File
@@ -0,0 +1,71 @@
#include "CommandBox.h"
#include "ui_CommandBox.h"
CommandBox::CommandBox(QWidget *parent) :
QWidget(parent),
ui(new Ui::CommandBox)
{
ui->setupUi(this);
m_parent = parent;
}
CommandBox::~CommandBox()
{
delete ui;
}
void CommandBox::closeEvent(QCloseEvent *event)
{
setFloat();
event->ignore();
}
void CommandBox::contextMenuEvent(QContextMenuEvent *event)
{
if(floatflag)
{
QMenu *menu = new QMenu(this);
QAction *pAction = new QAction("float",this);
connect(pAction,SIGNAL(triggered(bool)),
this,SLOT(setFloat()));
menu->addAction(pAction);
menu->move(cursor().pos());
menu->show();
}
}
void CommandBox::setFloat(void)
{
if(floatflag)
{
if(this->parent())
{
this->setParent(nullptr);
}
else
{
this->setParent(m_parent);
this->move(0,0);
}
this->show();
}
}
void CommandBox::setFloatFlag(bool flag)
{
floatflag = flag;
}
+42
View File
@@ -0,0 +1,42 @@
#ifndef COMMANDBOX_H
#define COMMANDBOX_H
#include <QWidget>
#include "QAction"
#include "QContextMenuEvent"
#include "QMenu"
namespace Ui {
class CommandBox;
}
class CommandBox : public QWidget
{
Q_OBJECT
public:
explicit CommandBox(QWidget *parent = nullptr);
~CommandBox();
protected:
void closeEvent(QCloseEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
public slots:
void setFloat(void);
void setFloatFlag(bool flag);
private:
QWidget *m_parent;
bool floatflag = true;
Ui::CommandBox *ui;
};
#endif // COMMANDBOX_H
+47
View File
@@ -0,0 +1,47 @@
QT += opengl
QT += network
QT += sql
QT += svg
QT += quickwidgets
QT += quick
QT += qml
INCLUDEPATH += $$PWD/../ComponentUI/CharInputter
INCLUDEPATH += $$PWD/../ComponentUI/Inputter
INCLUDEPATH += $$PWD/../ComponentUI/MultiSelector
INCLUDEPATH += $$PWD/../ComponentUI/Selector
INCLUDEPATH += $$PWD/../mavlink \
$$PWD/../mavlink/ardupilotmega \
$$PWD/../mavlink/common \
$$PWD/../mavlink/icarous \
$$PWD/../mavlink/uAvionix \
$$PWD/../mavlink/XYK \
$$PWD/../mavlink/message_definitions
FORMS += \
$$PWD/CommandBox.ui
HEADERS += \
$$PWD/CommandBox.h
SOURCES += \
$$PWD/CommandBox.cpp
+71
View File
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CommandBox</class>
<widget class="QWidget" name="CommandBox">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>428</width>
<height>417</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>110</x>
<y>20</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_3">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_4">
<property name="geometry">
<rect>
<x>110</x>
<y>50</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>