diff --git a/App/ComponentUI/Scope/Chart.cpp b/App/ComponentUI/Scope/Chart.cpp index 7d8415d..3387c3d 100644 --- a/App/ComponentUI/Scope/Chart.cpp +++ b/App/ComponentUI/Scope/Chart.cpp @@ -42,7 +42,7 @@ Chart::Chart(QChart *chart, QWidget *parent) setParent(parent); setChart(chart); - setScroll(true); + setScroll(true);//导致程序卡顿 chart->setPos(0,0); chart->resize(parent->size()); @@ -98,7 +98,7 @@ Chart::Chart(QWidget *parent) chart()->setPos(0,0); chart()->resize(parent->size()); - setScroll(true); + setScroll(true);//导致程序卡顿 //默认不使用,因为使用显卡加速图形会闪 setUseOpenGL(true); @@ -352,6 +352,8 @@ void Chart::chartUpdate(void) { QVector pv = s->pointsVector(); + + //qDebug() << s->name() << pv; if(pv.size() > 0) @@ -359,6 +361,7 @@ void Chart::chartUpdate(void) float max = pv.at(0).y(); float min = pv.at(0).y(); + foreach (QPointF p, pv) { if(max < p.y()) @@ -374,6 +377,7 @@ void Chart::chartUpdate(void) yMax.append(max); yMin.append(min); + } } } @@ -624,12 +628,18 @@ void Chart::setSerieData(QString name, QVariant data) if(s->pointsVector().size() > MaxCount) { + /* QList pv = s->points(); pv.removeFirst(); s->clear(); s->replace(pv); //qDebug() << "remove()" << s->points().size() ; + */ + + s->removePoints(0,1); + + //qDebug() << "s size:" << s->points().size(); } } @@ -719,11 +729,16 @@ void Chart::setSerieData(QString name,QVariant data,int colorindex = 3) if(s->pointsVector().size() > MaxCount) { + /* QList pv = s->points(); pv.removeFirst(); s->clear(); s->replace(pv); + */ + + s->removePoints(0,1); + //qDebug() << "remove()" << s->points().size() ; } } diff --git a/App/MissionUI/MissionUI.cpp b/App/MissionUI/MissionUI.cpp index 92c2453..9c95b18 100644 --- a/App/MissionUI/MissionUI.cpp +++ b/App/MissionUI/MissionUI.cpp @@ -6,10 +6,48 @@ MissionUI::MissionUI(QWidget *parent) : ui(new Ui::MissionUI) { ui->setupUi(this); + setWindowTitle(tr("Mission Table")); - prop = new propertyui(this); - prop->setGeometry(this->geometry()); + ui->tableWidget->setRowCount(10); //设置行数 + ui->tableWidget->setColumnCount(7); //设置列数为7 + ui->tableWidget->setGeometry(QRect(10,455,740,95)); //设置tableWidget的大小 + ui->tableWidget->setItem(0,0,new QTableWidgetItem("0")); //第一行第一列的内容设置为0 + ui->tableWidget->setItem(1,0,new QTableWidgetItem("1")); //第一行第一列的内容设置为1 + ui->tableWidget->setItem(2,0,new QTableWidgetItem("2")); //第一行第一列的内容设置为2 + ui->tableWidget->setItem(3,0,new QTableWidgetItem("3")); //第一行第一列的内容设置为3 + + + QComboBox *classBox = new QComboBox; + classBox->addItem("一年级"); + classBox->addItem("二年级"); + classBox->addItem("三年级"); + classBox->addItem("四年级"); + classBox->addItem("五年级"); + classBox->setCurrentText("一年级"); + ui->tableWidget->setCellWidget(0,1,classBox); + + + ui->tableWidget->setRowHeight(0,18); //设置第一行的行高 + ui->tableWidget->setRowHeight(1,18); //设置第二行的行高 + ui->tableWidget->setRowHeight(2,18); //设置第三行的行高 + ui->tableWidget->setRowHeight(3,18); //设置第三行的行高 + ui->tableWidget->setColumnWidth(0,45); //设置第一列的列宽 + ui->tableWidget->setColumnWidth(1,55); //设置第二列的列宽 + ui->tableWidget->setColumnWidth(2,160); //设置第三列的列宽 + ui->tableWidget->setColumnWidth(3,160); //设置第四列的列宽 + ui->tableWidget->setColumnWidth(4,100); //设置第五列的列宽 + ui->tableWidget->setColumnWidth(5,100); //设置第六列的列宽 + ui->tableWidget->setColumnWidth(6,100); //设置第七列的列宽 + ui->tableWidget->setHorizontalHeaderLabels(QStringList() <tableWidget->setFont(QFont("黑体",12,3));//设置字体 + QHeaderView* V_headerView = ui->tableWidget->verticalHeader(); + V_headerView->setHidden(true); //行名隐藏 + + QHeaderView* H_headerView = ui->tableWidget->horizontalHeader(); + H_headerView->setStretchLastSection(true); + H_headerView->setDefaultAlignment(Qt::AlignLeft); //表头信息显示居中靠左 + } @@ -18,11 +56,15 @@ MissionUI::~MissionUI() delete ui; } - +void MissionUI::closeEvent(QCloseEvent *event) +{ + event->ignore(); + this->setHidden(true); +} void MissionUI::resizeEvent(QResizeEvent *event) { - prop->setGeometry(0,0,this->width(),this->height()); + } diff --git a/App/MissionUI/MissionUI.h b/App/MissionUI/MissionUI.h index 22b18d0..4df7072 100644 --- a/App/MissionUI/MissionUI.h +++ b/App/MissionUI/MissionUI.h @@ -3,11 +3,9 @@ #include - -#include "propertyui.h" #include "Inputter.h" #include "Selector.h" - +#include "QComboBox" namespace Ui { @@ -24,6 +22,7 @@ public: protected slots: + void closeEvent(QCloseEvent *event); void resizeEvent(QResizeEvent *event); @@ -31,7 +30,6 @@ private: Ui::MissionUI *ui; - propertyui *prop = nullptr; diff --git a/App/MissionUI/MissionUI.ui b/App/MissionUI/MissionUI.ui index 28856d7..213c1b9 100644 --- a/App/MissionUI/MissionUI.ui +++ b/App/MissionUI/MissionUI.ui @@ -6,13 +6,73 @@ 0 0 - 280 - 584 + 736 + 445 Form + + + + + QFrame::Plain + + + 2 + + + 2 + + + QAbstractItemView::DoubleClicked + + + false + + + false + + + QAbstractItemView::ScrollPerPixel + + + true + + + Qt::SolidLine + + + false + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + + diff --git a/App/MissionUI/propertyui.cpp b/App/MissionUI/propertyui.cpp index 5f16468..27c3c3d 100644 --- a/App/MissionUI/propertyui.cpp +++ b/App/MissionUI/propertyui.cpp @@ -147,6 +147,10 @@ propertyui::propertyui(QWidget *parent) : //rebuildUI(" "); + table = new MissionUI(); + + //table->hide(); + } @@ -879,6 +883,11 @@ void propertyui::setWayPointProperty(float param1,float param2,float param3,floa propertyui::~propertyui() { + if(table) + { + table->deleteLater(); + } + delete ui; } @@ -2013,3 +2022,20 @@ void propertyui::on_pushButton_Group_clicked() selector->show(); } + +void propertyui::on_pushButton_Ruler_clicked() +{ + +} + +void propertyui::on_pushButton_Table_clicked() +{ + if(table->isHidden()) + { + table->show(); + } + else + { + table->hide(); + } +} diff --git a/App/MissionUI/propertyui.h b/App/MissionUI/propertyui.h index 396ff8e..7d8a81b 100644 --- a/App/MissionUI/propertyui.h +++ b/App/MissionUI/propertyui.h @@ -36,7 +36,7 @@ #include "QtQmlDepends" - +#include "MissionUI.h" #ifdef QtopmapWidget @@ -318,10 +318,12 @@ private slots: void on_pushButton_Lng_clicked(); - //void on_pushButton_2_clicked(); - void on_pushButton_Group_clicked(); + void on_pushButton_Ruler_clicked(); + + void on_pushButton_Table_clicked(); + private: QString _loadErrorString(const QString& errorString) const; bool _infoAvailable(const QString& key) const { return _infoMap.contains(key); } @@ -371,6 +373,9 @@ private: Ui::propertyui *ui; + MissionUI *table; + + QByteArray allBytes; QJsonArray MAV_CMD_infoArray; diff --git a/App/MissionUI/propertyui.ui b/App/MissionUI/propertyui.ui index c3a6731..f304463 100644 --- a/App/MissionUI/propertyui.ui +++ b/App/MissionUI/propertyui.ui @@ -7,7 +7,7 @@ 0 0 331 - 926 + 982 @@ -69,7 +69,7 @@ - + 80 @@ -77,7 +77,7 @@ - Next + Table @@ -419,7 +419,7 @@ - + 0 @@ -438,7 +438,7 @@ - + 0 @@ -654,7 +654,7 @@ - + 80 @@ -662,7 +662,7 @@ - Previous + Ruler @@ -682,38 +682,5 @@ - - - pushButton_3 - clicked() - pushButton_Previous - click() - - - 40 - 227 - - - 200 - 163 - - - - - pushButton_2 - clicked() - pushButton_Next - click() - - - 203 - 246 - - - 291 - 158 - - - - + diff --git a/MavLinkNode/ThreadTemplet.cpp b/MavLinkNode/ThreadTemplet.cpp index 40a6842..5cd5521 100644 --- a/MavLinkNode/ThreadTemplet.cpp +++ b/MavLinkNode/ThreadTemplet.cpp @@ -5,7 +5,7 @@ ThreadTemplet::ThreadTemplet(QObject *parent) : QObject(parent) running_flag = false; thread = new QThread();//指定父对象可以自动析构 - thread->setPriority(QThread::IdlePriority); + this->moveToThread(thread); connect(thread, &QThread::started, this, &ThreadTemplet::process); @@ -40,7 +40,7 @@ void ThreadTemplet::start() running_flag = true; thread->start(); qDebug() << "thread start" << thread->isRunning(); - + thread->setPriority(QThread::IdlePriority); } else { @@ -135,12 +135,12 @@ void ThreadTemplet::Send(mavlink_message_t msg) void ThreadTemplet::initbuff(void) { - client_buff.max_size = 10 * 1024 *1024;//10M + client_buff.max_size = 1 * 1024 *1024;//10M client_buff.buff[0].clear(); client_buff.buff[1].clear(); client_buff.select = 0; - serial_buff.max_size = 10 * 1024 *1024; + serial_buff.max_size = 1 * 1024 *1024; serial_buff.buff[0].clear(); serial_buff.buff[1].clear(); serial_buff.select = 0; diff --git a/MavLinkNode/mavlinknode.cpp b/MavLinkNode/mavlinknode.cpp index fbafc9f..ef8fe65 100644 --- a/MavLinkNode/mavlinknode.cpp +++ b/MavLinkNode/mavlinknode.cpp @@ -792,8 +792,6 @@ void MavLinkNode::MAVLinkRcv_Handler(mavlink_message_t msg) void MavLinkNode::StatusParse(mavlink_message_t msg) { - - //_vehicle vehicle = vehicleList.value(msg.sysid); vehicle.sysid = msg.sysid; @@ -1158,8 +1156,17 @@ void MavLinkNode::StatusParse(mavlink_message_t msg) //emit signal_vehicle(vehicle); - emit state_updated(); + + + + + static qint64 frq_time = 0; + if((QDateTime::currentMSecsSinceEpoch() - frq_time) >= 200) + { + emit state_updated(); + frq_time = QDateTime::currentMSecsSinceEpoch(); + } } diff --git a/opmap/mapwidget/opmapwidget.cpp b/opmap/mapwidget/opmapwidget.cpp index cdd02bd..4946e15 100644 --- a/opmap/mapwidget/opmapwidget.cpp +++ b/opmap/mapwidget/opmapwidget.cpp @@ -1828,7 +1828,7 @@ void OPMapWidget::WPLoad(QString path)//带文件目录参数 float param3 = params.at(2).toDouble(); float param4 = params.at(3).toDouble(); int32_t x = params.at(4).toDouble() * 10e6; - int32_t y = params.at(5).toDouble() * 10e6;; + int32_t y = params.at(5).toDouble() * 10e6; float z = params.at(6).toDouble(); internals::PointLatLng LatLng; @@ -1844,7 +1844,7 @@ void OPMapWidget::WPLoad(QString path)//带文件目录参数 emit setWPProperty(param1,param2,param3,param4, x,y,z, seq, - currentGroup,//当前组 + mission_type,//当前组 command, 0, 0, @@ -1881,14 +1881,24 @@ void OPMapWidget::WPSave(QString path)//带文件目录参数 //geoFence节点写入 (mission type == 1,2) - { - QJsonArray circles; - QJsonArray polygons; + //判断围栏数量大于0时写入,否则不写 + + QJsonArray circles; + QJsonArray polygons; + { + QJsonArray polygon; + QJsonObject polygonObj; + + polygonObj["inclusion"] = true; + polygonObj["polygon"] = polygon; + polygonObj["version"] = 1; + + polygons.append(polygonObj); - geoFence.insert("circles",circles); - geoFence.insert("polygons",polygons); - geoFence.insert("version",2); } + geoFence.insert("circles",circles); + geoFence.insert("polygons",polygons); + geoFence.insert("version",2); //mission节点写入 (mission type == 3...) {