b
This commit is contained in:
@@ -1,6 +1,38 @@
|
||||
#include "MenuBarUI.h"
|
||||
#include "ui_MenuBarUI.h"
|
||||
|
||||
|
||||
QTextBrowser *log_te;
|
||||
|
||||
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||
{
|
||||
QString msgstr;
|
||||
switch (type) {
|
||||
case QtDebugMsg:
|
||||
msgstr = QString::asprintf("Debug: %s (%s:%u, %s)", qPrintable(msg), context.file, context.line, context.function);
|
||||
break;
|
||||
case QtInfoMsg:
|
||||
msgstr = QString::asprintf("Info: %s", qPrintable(msg));
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
msgstr = QString::asprintf("Warning: %s (%s:%u, %s)", qPrintable(msg), context.file, context.line, context.function);
|
||||
break;
|
||||
case QtCriticalMsg:
|
||||
msgstr = QString::asprintf("Critical: %s (%s:%u, %s)", qPrintable(msg), context.file, context.line, context.function);
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
msgstr = QString::asprintf("Fatal: %s (%s:%u, %s)", qPrintable(msg), context.file, context.line, context.function);
|
||||
break;
|
||||
}
|
||||
log_te->append(msgstr);
|
||||
QTextCursor cursor=log_te->textCursor();
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
log_te->setTextCursor(cursor);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
MenuBarUI::MenuBarUI(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::MenuBarUI)
|
||||
@@ -10,6 +42,10 @@ MenuBarUI::MenuBarUI(QWidget *parent) :
|
||||
this->setStyleSheet("QPushButton {background-color: palegoldenrod;border-width: 2px;border-color: darkkhaki;border-style: solid;border-radius: 5;padding: 3px;}");
|
||||
|
||||
|
||||
ui->textBrowser->setText( tr("Starting...\n"));
|
||||
log_te = ui->textBrowser;
|
||||
|
||||
qInstallMessageHandler(myMessageOutput);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include "QDebug"
|
||||
#include "QTextEdit"
|
||||
#include "QTextBrowser"
|
||||
|
||||
namespace Ui {
|
||||
class MenuBarUI;
|
||||
|
||||
+81
-43
@@ -9,28 +9,30 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>720</width>
|
||||
<height>100</height>
|
||||
<width>858</width>
|
||||
<height>82</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
@@ -39,32 +41,38 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextBrowser" name="textBrowser"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pushButton_Setting">
|
||||
<property name="minimumSize">
|
||||
@@ -73,11 +81,36 @@
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Setting</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="pushButton_Flight">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Flight</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pushButton_SelfTest">
|
||||
<property name="minimumSize">
|
||||
@@ -86,6 +119,12 @@
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SelfTest</string>
|
||||
</property>
|
||||
@@ -99,21 +138,14 @@
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mission</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="pushButton_Flight">
|
||||
<property name="minimumSize">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Flight</string>
|
||||
<string>Mission</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -125,6 +157,12 @@
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Info</string>
|
||||
</property>
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
<file>Inputter.qss</file>
|
||||
<file>Selector.qss</file>
|
||||
<file>propertyui.qss</file>
|
||||
<file>MultiSelector.qss</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
|
||||
|
||||
.QListWidget {
|
||||
background-color: #F0FFFF;
|
||||
border-width: 2px;
|
||||
border-color: darkkhaki;
|
||||
border-style: solid;
|
||||
border-radius: 5;
|
||||
padding: 3px;
|
||||
font: 20px;
|
||||
}
|
||||
|
||||
.QListWidget::Item {
|
||||
height: 60;
|
||||
}
|
||||
|
||||
|
||||
.QScrollBar{
|
||||
width:60;
|
||||
background-color:palegoldenrod;
|
||||
}
|
||||
|
||||
.QLabel {
|
||||
background-color: #FFFFFF;
|
||||
border-width: 2px;
|
||||
border-color: darkkhaki;
|
||||
border-style: solid;
|
||||
border-radius: 5;
|
||||
padding: 3px;
|
||||
font :15px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ MultiSelector::MultiSelector(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
|
||||
//load qss
|
||||
QFile file(":/qss/Selector.qss");
|
||||
QFile file(":/qss/MultiSelector.qss");
|
||||
file.open(QFile::ReadOnly);
|
||||
QTextStream filetext(&file);
|
||||
QString stylesheet = filetext.readAll();
|
||||
@@ -108,12 +108,35 @@ void MultiSelector::reBuildList(void)
|
||||
QString Item = i.value();
|
||||
|
||||
QWidget *widget = new QWidget(ui->listWidget);
|
||||
|
||||
QLabel *seq = new QLabel(widget);
|
||||
QLabel *type = new QLabel(widget);
|
||||
|
||||
seq->setMaximumWidth(80);
|
||||
seq->setMinimumHeight(60);
|
||||
seq->setMinimumWidth(80);
|
||||
|
||||
type->setMinimumWidth(80);
|
||||
type->setMinimumHeight(60);
|
||||
|
||||
|
||||
type->setText(Item);
|
||||
|
||||
QHBoxLayout *layout = new QHBoxLayout;
|
||||
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(1);
|
||||
|
||||
|
||||
layout->addWidget(seq);
|
||||
layout->addWidget(type);
|
||||
widget->setLayout(layout);
|
||||
//创建自定义的item
|
||||
//将widget作为列表的item
|
||||
QListWidgetItem *ITEM = new QListWidgetItem();
|
||||
|
||||
ITEM->setText(Item);
|
||||
ITEM->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
//ITEM->setText(Item);
|
||||
//ITEM->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
ui->listWidget->addItem(ITEM);
|
||||
ui->listWidget->setItemWidget(ITEM, widget);
|
||||
@@ -134,7 +157,7 @@ void MultiSelector::on_ListClicked(QModelIndex index)
|
||||
|
||||
void MultiSelector::on_ListDoubleClicked(QModelIndex index)
|
||||
{
|
||||
emit confirmValue(ui->listWidget->item(index.row())->text());
|
||||
emit confirmValue(index.row());
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "QDebug"
|
||||
#include "QMap"
|
||||
#include "QPushButton"
|
||||
#include "QLabel"
|
||||
#include <QModelIndex>
|
||||
#include "QHBoxLayout"
|
||||
#include <QMimeData>
|
||||
|
||||
@@ -20,6 +20,20 @@ QScrollBar{
|
||||
background-color:palegoldenrod;
|
||||
}
|
||||
|
||||
.QPushButton {
|
||||
background-color: #FFFFFF;
|
||||
border-width: 2px;
|
||||
border-color: darkkhaki;
|
||||
border-style: solid;
|
||||
border-radius: 5;
|
||||
padding: 3px;
|
||||
font :15px;
|
||||
}
|
||||
|
||||
.QPushButton:pressed {
|
||||
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #dadbde, stop: 1 #f6f7fa);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -975,6 +975,63 @@ bool propertyui::loadJsonInfo(const QJsonObject& jsonObject, bool requireFullObj
|
||||
}
|
||||
|
||||
|
||||
|
||||
void propertyui::setSeqNav(QVariant value)
|
||||
{
|
||||
//ui->pushButton_friendlyName->setText(value.toString());
|
||||
|
||||
/*
|
||||
for(QJsonValue info: MAV_CMD_infoArray) {
|
||||
if (!info.isObject()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(info.toObject().find(_friendlyNameJsonKey).value() == value.toString())
|
||||
{
|
||||
m_command = (MAV_CMD)info.toObject().find(_idJsonKey).value().toInt();
|
||||
}
|
||||
}*/
|
||||
|
||||
//然后重置一下参数
|
||||
//WayPointPropertyUpdate();
|
||||
//更新界面
|
||||
//rebuildUI(value.toString());
|
||||
|
||||
|
||||
//读取这个值得航点
|
||||
emit WPotherPoint(value.toInt());
|
||||
}
|
||||
|
||||
void propertyui::on_pushButton_Seq_clicked()
|
||||
{
|
||||
MultiSelector *selector = new MultiSelector(this);
|
||||
selector->setGeometry(0,0,this->width(),this->height());
|
||||
|
||||
|
||||
//读取所有的航点的cmd,然后设置list
|
||||
QStringList list;
|
||||
|
||||
for(QJsonValue info: MAV_CMD_infoArray) {
|
||||
if (!info.isObject()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString str = info.toObject().value(_friendlyNameJsonKey).toString();
|
||||
if(str.size() != 0)
|
||||
{
|
||||
list.append(str);
|
||||
}
|
||||
}
|
||||
|
||||
selector->setList(list,ui->pushButton_Seq->text());
|
||||
|
||||
connect(selector,SIGNAL(confirmValue(QVariant)),
|
||||
this,SLOT(setSeqNav(QVariant)));
|
||||
|
||||
selector->show();
|
||||
}
|
||||
|
||||
|
||||
void propertyui::setFriendlyName(QVariant value)
|
||||
{
|
||||
ui->pushButton_friendlyName->setText(value.toString());
|
||||
@@ -1451,21 +1508,25 @@ void propertyui::on_pushButton_Param7_clicked()
|
||||
|
||||
void propertyui::on_pushButton_Load_clicked()
|
||||
{
|
||||
|
||||
qDebug() << "Load";
|
||||
emit WPLoad();
|
||||
}
|
||||
|
||||
void propertyui::on_pushButton_Save_clicked()
|
||||
{
|
||||
|
||||
qDebug() << "Save";
|
||||
emit WPSave();
|
||||
}
|
||||
|
||||
void propertyui::on_pushButton_Upload_clicked()
|
||||
{
|
||||
qDebug() << "Upload";
|
||||
emit WPUpload();
|
||||
}
|
||||
|
||||
void propertyui::on_pushButton_Download_clicked()
|
||||
{
|
||||
qDebug() << "Download";
|
||||
emit WPDownload();
|
||||
}
|
||||
|
||||
@@ -1492,3 +1553,5 @@ void propertyui::on_pushButton_Delete_clicked()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "QVBoxLayout"
|
||||
#include "QGridLayout"
|
||||
|
||||
#include "multiselector.h"
|
||||
#include "Selector.h"
|
||||
#include "Inputter.h"
|
||||
|
||||
@@ -241,6 +242,8 @@ Q_SIGNALS:
|
||||
void WPDelete(int seq);
|
||||
|
||||
|
||||
void WPSave(void);
|
||||
void WPLoad(void);
|
||||
void WPUpload(void);
|
||||
void WPDownload(void);
|
||||
|
||||
@@ -248,6 +251,7 @@ Q_SIGNALS:
|
||||
|
||||
private slots:
|
||||
|
||||
void setSeqNav(QVariant value);
|
||||
void setFriendlyName(QVariant value);
|
||||
void setAltitude(QVariant value);
|
||||
|
||||
@@ -300,6 +304,8 @@ private slots:
|
||||
|
||||
void on_pushButton_Save_clicked();
|
||||
|
||||
void on_pushButton_Seq_clicked();
|
||||
|
||||
private:
|
||||
QString _loadErrorString(const QString& errorString) const;
|
||||
bool _infoAvailable(const QString& key) const { return _infoMap.contains(key); }
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
#include "QHBoxLayout"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -838,7 +838,25 @@ void OPMapWidget::WPotherPoint(int number)
|
||||
}
|
||||
}
|
||||
|
||||
void OPMapWidget::WPLoad(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OPMapWidget::WPSave(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OPMapWidget::WPDownload(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OPMapWidget::WPUpload(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -537,6 +537,10 @@ public slots:
|
||||
WayPointItem *WPInsert(const distBearingAltitude &relative, const QString &description, const int &position);
|
||||
|
||||
|
||||
void WPLoad(void);
|
||||
void WPSave(void);
|
||||
void WPDownload(void);
|
||||
void WPUpload(void);
|
||||
|
||||
|
||||
void WPotherPoint(int number);
|
||||
|
||||
Reference in New Issue
Block a user