表格完善,测量功能添加
This commit is contained in:
+40
-16
@@ -17,11 +17,6 @@ MissionUI::MissionUI(QWidget *parent) :
|
|||||||
this->setStyleSheet(stylesheet);
|
this->setStyleSheet(stylesheet);
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
//this->setFocus();
|
|
||||||
//this->setFocusPolicy(Qt::StrongFocus);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ui->pushButton_load->setFixedSize(80,40);
|
ui->pushButton_load->setFixedSize(80,40);
|
||||||
ui->pushButton_save->setFixedSize(80,40);
|
ui->pushButton_save->setFixedSize(80,40);
|
||||||
ui->pushButton_upload->setFixedSize(80,40);
|
ui->pushButton_upload->setFixedSize(80,40);
|
||||||
@@ -67,11 +62,11 @@ MissionUI::MissionUI(QWidget *parent) :
|
|||||||
|
|
||||||
table->setHorizontalHeaderLabels(QStringList() <<tr("number")<<tr("command")<<tr("par1")<<tr("par2")<<tr("par3")<<tr("par4")<<tr("lat")<<tr("lng")<<tr("alt"));
|
table->setHorizontalHeaderLabels(QStringList() <<tr("number")<<tr("command")<<tr("par1")<<tr("par2")<<tr("par3")<<tr("par4")<<tr("lat")<<tr("lng")<<tr("alt"));
|
||||||
QHeaderView* V_headerView = table->verticalHeader();
|
QHeaderView* V_headerView = table->verticalHeader();
|
||||||
V_headerView->setHidden(true); //行名隐藏
|
V_headerView->setHidden(true); //行名隐藏
|
||||||
|
|
||||||
QHeaderView* H_headerView = table->horizontalHeader();
|
QHeaderView* H_headerView = table->horizontalHeader();
|
||||||
H_headerView->setDefaultAlignment(Qt::AlignLeft); //表头信息显示居中靠左
|
H_headerView->setDefaultAlignment(Qt::AlignLeft); //表头信息显示居中靠左
|
||||||
H_headerView->setHighlightSections(false);//高亮选中内容的所在列标题
|
H_headerView->setHighlightSections(false); //不高亮选中内容的所在列标题
|
||||||
H_headerView->setStretchLastSection(true);
|
H_headerView->setStretchLastSection(true);
|
||||||
|
|
||||||
|
|
||||||
@@ -247,6 +242,8 @@ void MissionUI::setCurrent(int group,int idx)
|
|||||||
{
|
{
|
||||||
widget->selectRow(idx - 1);
|
widget->selectRow(idx - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//settableGroup(group);//切换会引起变化事件,导致重新刷新
|
||||||
}
|
}
|
||||||
|
|
||||||
void MissionUI::settableGroup(int group)
|
void MissionUI::settableGroup(int group)
|
||||||
@@ -342,6 +339,35 @@ void MissionUI::on_pushButton_upload_clicked()
|
|||||||
|
|
||||||
void MissionUI::on_pushButton_download_clicked()
|
void MissionUI::on_pushButton_download_clicked()
|
||||||
{
|
{
|
||||||
|
QTableWidget *widget;
|
||||||
|
//根据tabwidget
|
||||||
|
int tab_idx =ui->tabWidget->currentIndex();
|
||||||
|
|
||||||
|
switch (tab_idx) {
|
||||||
|
case 0:
|
||||||
|
widget = tablelist.value(1);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
widget = tablelist.value(3);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
widget = tablelist.value(4);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
widget = tablelist.value(5);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
widget = tablelist.value(6);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (widget->rowCount() > 0) {
|
||||||
|
widget->removeRow(widget->currentRow());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
emit WPDownload();
|
emit WPDownload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,19 +497,11 @@ void MissionUI::on_pushButton_clean_clicked()
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
int count = widget->rowCount();
|
|
||||||
for (int i = 0;i < count;i++) {
|
|
||||||
widget->removeRow(i);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
while (widget->rowCount() > 0) {
|
while (widget->rowCount() > 0) {
|
||||||
widget->removeRow(widget->currentRow());
|
widget->removeRow(widget->currentRow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
emit WPDeleteAll();
|
emit WPDeleteAll();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -577,6 +595,12 @@ void MissionUI::itemDoubleClicked(QTableWidgetItem *item)
|
|||||||
widget->removeCellWidget(row,column);
|
widget->removeCellWidget(row,column);
|
||||||
emit setCommand(str);//直接修改底层,让底层返回数据更新到界面
|
emit setCommand(str);//直接修改底层,让底层返回数据更新到界面
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(combox,&QComboBox::editTextChanged,[=]{
|
||||||
|
QString str = combox->currentText();
|
||||||
|
widget->removeCellWidget(row,column);
|
||||||
|
emit setCommand(str);//直接修改底层,让底层返回数据更新到界面
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else if(column == 2)
|
else if(column == 2)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2167,9 +2167,22 @@ void propertyui::on_pushButton_Group_clicked()
|
|||||||
selector->show();
|
selector->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void propertyui::measureState(bool flag)
|
||||||
|
{
|
||||||
|
if(flag == true)
|
||||||
|
{
|
||||||
|
ui->pushButton_Ruler->setText("Measuring");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->pushButton_Ruler->setText("Measure");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void propertyui::on_pushButton_Ruler_clicked()
|
void propertyui::on_pushButton_Ruler_clicked()
|
||||||
{
|
{
|
||||||
|
emit ruler_clicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void propertyui::on_pushButton_Table_clicked()
|
void propertyui::on_pushButton_Table_clicked()
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ public slots:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void measureState(bool flag);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -260,6 +260,9 @@ Q_SIGNALS:
|
|||||||
|
|
||||||
void getAllPoints(int group);
|
void getAllPoints(int group);
|
||||||
|
|
||||||
|
void ruler_clicked();
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void GroupChanged(int value);
|
void GroupChanged(int value);
|
||||||
|
|||||||
@@ -662,7 +662,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Ruler</string>
|
<string>Measure</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
+9
-2
@@ -278,8 +278,6 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
connect(toolsui->index2,SIGNAL(setMultiple(double)),
|
connect(toolsui->index2,SIGNAL(setMultiple(double)),
|
||||||
dlink->mavlinknode->replay,SLOT(setMultiple(double)),Qt::DirectConnection);
|
dlink->mavlinknode->replay,SLOT(setMultiple(double)),Qt::DirectConnection);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
connect(dlink->mavlinknode->replay,SIGNAL(currentPercentage(float)),
|
connect(dlink->mavlinknode->replay,SIGNAL(currentPercentage(float)),
|
||||||
toolsui->index2,SLOT(setCurrentPercentage(float)));
|
toolsui->index2,SLOT(setCurrentPercentage(float)));
|
||||||
|
|
||||||
@@ -416,6 +414,15 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
map,SLOT(getAllPoints(int)));
|
map,SLOT(getAllPoints(int)));
|
||||||
|
|
||||||
|
|
||||||
|
connect(map,SIGNAL(settableGroup(int)),
|
||||||
|
missionUI,SIGNAL(settableGroup(int)));
|
||||||
|
|
||||||
|
connect(missionUI,SIGNAL(ruler_clicked()),
|
||||||
|
map,SLOT(ruler_clicked()));
|
||||||
|
|
||||||
|
connect(map,SIGNAL(measureState(bool)),
|
||||||
|
missionUI,SLOT(measureState(bool)));
|
||||||
|
|
||||||
|
|
||||||
//dlink ----- map
|
//dlink ----- map
|
||||||
connect(map,SIGNAL(signal_WPDownload(uint8_t,uint8_t,int)),
|
connect(map,SIGNAL(signal_WPDownload(uint8_t,uint8_t,int)),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "mavlinknode.h"
|
#include "mavlinknode.h"
|
||||||
|
#include "QElapsedTimer"
|
||||||
/*
|
/*
|
||||||
* mavlink 解析相关内容请参考如下
|
* mavlink 解析相关内容请参考如下
|
||||||
* https://mavlink.io/en/services/command.html
|
* https://mavlink.io/en/services/command.html
|
||||||
@@ -18,7 +18,7 @@ MavLinkNode::MavLinkNode(QObject *parent) : ThreadTemplet(parent)
|
|||||||
CommucationOverTimer = 1000;
|
CommucationOverTimer = 1000;
|
||||||
|
|
||||||
|
|
||||||
setRunFrq(10);//50
|
setRunFrq(100);//50
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -481,10 +481,18 @@ void MavLinkNode::process()//线程函数
|
|||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
QByteArray datagram = nullptr;
|
QByteArray datagram = nullptr;
|
||||||
bool isIdle = true;
|
bool isIdle = true;
|
||||||
|
|
||||||
|
|
||||||
|
QElapsedTimer time;
|
||||||
|
time.start();
|
||||||
|
|
||||||
while (running_flag)
|
while (running_flag)
|
||||||
{
|
{
|
||||||
|
time.restart();
|
||||||
|
|
||||||
|
|
||||||
count ++;
|
count ++;
|
||||||
//QThread::msleep(1000/running_frq);
|
QThread::msleep(1000/running_frq);
|
||||||
//timer->start();
|
//timer->start();
|
||||||
|
|
||||||
//解码从UDP来的
|
//解码从UDP来的
|
||||||
@@ -519,6 +527,9 @@ void MavLinkNode::process()//线程函数
|
|||||||
{
|
{
|
||||||
// QThread::msleep(1000/running_frq);
|
// QThread::msleep(1000/running_frq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nsec = time.nsecsElapsed();
|
||||||
|
//qDebug() << "mavlinknode a loop using time:" << nsec << "ns";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -1,7 +1,7 @@
|
|||||||
#include "dlink.h"
|
#include "dlink.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "QDateTime"
|
#include "QDateTime"
|
||||||
|
#include "QElapsedTimer"
|
||||||
|
|
||||||
DLink::DLink(QObject *parent) : QObject(parent)
|
DLink::DLink(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
@@ -428,6 +428,8 @@ void DLink::readPendingDatagramsSerialPort(void)
|
|||||||
|
|
||||||
void DLink::readPendingDatagramsClient(void)
|
void DLink::readPendingDatagramsClient(void)
|
||||||
{
|
{
|
||||||
|
QElapsedTimer time;
|
||||||
|
time.start();
|
||||||
//轮番查询
|
//轮番查询
|
||||||
if(Clientsock)
|
if(Clientsock)
|
||||||
{
|
{
|
||||||
@@ -439,6 +441,10 @@ void DLink::readPendingDatagramsClient(void)
|
|||||||
emit recieveMessage(SourceType::c_sock,datagram);
|
emit recieveMessage(SourceType::c_sock,datagram);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int milsec = time.elapsed();
|
||||||
|
|
||||||
|
//qDebug() << "a loop using time:" << milsec << "ms";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DLink::processPendingMulticastDatagrams(void)
|
void DLink::processPendingMulticastDatagrams(void)
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ void MeasureLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myPen.setColor("#ffff00");
|
myPen.setColor("#FF00FF");
|
||||||
}
|
}
|
||||||
|
|
||||||
painter->setPen(myPen);
|
painter->setPen(myPen);
|
||||||
|
|||||||
@@ -125,11 +125,6 @@ OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView
|
|||||||
connect(waypointsetting,SIGNAL(WPLoad(QString)),
|
connect(waypointsetting,SIGNAL(WPLoad(QString)),
|
||||||
this,SLOT(WPLoad(QString)));
|
this,SLOT(WPLoad(QString)));
|
||||||
|
|
||||||
/*
|
|
||||||
connect(this,SIGNAL(allPoint(QMap<int,int>)),
|
|
||||||
waypointsetting,SLOT(setallPoint(QMap<int,int>)));
|
|
||||||
*/
|
|
||||||
|
|
||||||
connect(waypointsetting,SIGNAL(searchall()),
|
connect(waypointsetting,SIGNAL(searchall()),
|
||||||
this,SLOT(WPsearchall()));
|
this,SLOT(WPsearchall()));
|
||||||
|
|
||||||
@@ -198,7 +193,12 @@ void OPMapWidget::ruler_clicked(void)
|
|||||||
if(isMeasure)
|
if(isMeasure)
|
||||||
{
|
{
|
||||||
isMeasure = false;
|
isMeasure = false;
|
||||||
this->setCursor(Qt::ArrowCursor);
|
//this->setCursor(Qt::ArrowCursor);
|
||||||
|
if(measureline)
|
||||||
|
{
|
||||||
|
measureline->hide();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -210,9 +210,11 @@ void OPMapWidget::ruler_clicked(void)
|
|||||||
measureline->show();
|
measureline->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap pix(":/markers/images/ruler.png");
|
//QPixmap pix(":/markers/images/ruler.png");
|
||||||
this->setCursor(QCursor(pix.scaled(QSize(50,50), Qt::KeepAspectRatio)));
|
//this->setCursor(QCursor(pix.scaled(QSize(50,50), Qt::KeepAspectRatio)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit measureState(isMeasure);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPMapWidget::table_clicked(void)
|
void OPMapWidget::table_clicked(void)
|
||||||
@@ -632,8 +634,8 @@ void OPMapWidget::mouseMoveEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
if(isMeasure)
|
if(isMeasure)
|
||||||
{
|
{
|
||||||
QPixmap pix(":/markers/images/ruler.png");
|
//QPixmap pix(":/markers/images/ruler.png");
|
||||||
this->setCursor(QCursor(pix.scaled(QSize(50,50), Qt::KeepAspectRatio)));
|
//this->setCursor(QCursor(pix.scaled(QSize(50,50), Qt::KeepAspectRatio)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -709,8 +711,8 @@ void OPMapWidget::mousePressEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
if(isMeasure)
|
if(isMeasure)
|
||||||
{
|
{
|
||||||
QPixmap pix(":/markers/images/ruler.png");
|
//QPixmap pix(":/markers/images/ruler.png");
|
||||||
this->setCursor(QCursor(pix.scaled(QSize(50,50), Qt::KeepAspectRatio)));
|
//this->setCursor(QCursor(pix.scaled(QSize(50,50), Qt::KeepAspectRatio)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -725,8 +727,8 @@ void OPMapWidget::mouseReleaseEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
if(isMeasure)
|
if(isMeasure)
|
||||||
{
|
{
|
||||||
QPixmap pix(":/markers/images/ruler.png");
|
//QPixmap pix(":/markers/images/ruler.png");
|
||||||
this->setCursor(QCursor(pix.scaled(QSize(50,50), Qt::KeepAspectRatio)));
|
//this->setCursor(QCursor(pix.scaled(QSize(50,50), Qt::KeepAspectRatio)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//qDebug() << "relea";
|
//qDebug() << "relea";
|
||||||
@@ -738,8 +740,8 @@ void OPMapWidget::mouseDoubleClickEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
if(isMeasure)
|
if(isMeasure)
|
||||||
{
|
{
|
||||||
QPixmap pix(":/markers/images/ruler.png");
|
//QPixmap pix(":/markers/images/ruler.png");
|
||||||
this->setCursor(QCursor(pix.scaled(QSize(50,50), Qt::KeepAspectRatio)));
|
//this->setCursor(QCursor(pix.scaled(QSize(50,50), Qt::KeepAspectRatio)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isMeasure)
|
if(isMeasure)
|
||||||
@@ -2213,6 +2215,8 @@ void OPMapWidget::WPGroup(int value)
|
|||||||
{
|
{
|
||||||
currentGroup = value;
|
currentGroup = value;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
qDebug() << "group checkout" << value;
|
qDebug() << "group checkout" << value;
|
||||||
|
|
||||||
//切换当前航线,其他都隐藏,或者高亮当前
|
//切换当前航线,其他都隐藏,或者高亮当前
|
||||||
@@ -2273,6 +2277,8 @@ void OPMapWidget::WPGroup(int value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit settableGroup(currentGroup);
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -532,6 +532,7 @@ signals:
|
|||||||
//map property
|
//map property
|
||||||
void MapTypes(QStringList list);
|
void MapTypes(QStringList list);
|
||||||
|
|
||||||
|
void settableGroup(int);
|
||||||
|
|
||||||
void TotalDistanceUpdate(double);
|
void TotalDistanceUpdate(double);
|
||||||
|
|
||||||
@@ -631,6 +632,9 @@ signals:
|
|||||||
|
|
||||||
void setCurrent(int seq);
|
void setCurrent(int seq);
|
||||||
|
|
||||||
|
void measureState(bool);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user