检查闪退问题
This commit is contained in:
@@ -235,9 +235,6 @@ void StateWidget::setColor(state s)
|
|||||||
bar->style()->polish(bar);
|
bar->style()->polish(bar);
|
||||||
}
|
}
|
||||||
|
|
||||||
//更i性能太多了容易死机
|
|
||||||
//update();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StateWidget::setValue(QString s)
|
void StateWidget::setValue(QString s)
|
||||||
@@ -250,16 +247,24 @@ void StateWidget::setValue(QString s)
|
|||||||
|
|
||||||
|
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
double value = s.toDouble(&flag);
|
double num = s.toDouble(&flag);
|
||||||
|
|
||||||
value = (qIsNaN(value))?(0):(value);
|
double value = (qIsNaN(num))?(0):(num);
|
||||||
|
|
||||||
if(bar)
|
if(bar)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(value > bar->maximum())
|
if(value > bar->maximum())
|
||||||
{
|
{
|
||||||
|
bar->setRange(min,value);
|
||||||
|
}
|
||||||
|
else if(value > bar->minimum())
|
||||||
|
{
|
||||||
|
bar->setRange(value,max);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bar->setRange(min,max);
|
||||||
}
|
}
|
||||||
|
|
||||||
bar->setValue(value);
|
bar->setValue(value);
|
||||||
@@ -323,7 +328,7 @@ void StateWidget::setRange(double m_min,double m_max)
|
|||||||
|
|
||||||
if(bar)
|
if(bar)
|
||||||
{
|
{
|
||||||
bar->setRange(m_min,m_max);
|
bar->setRange(min,max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
|
|
||||||
|
|
||||||
# include sub project
|
# include sub project
|
||||||
#include (./ParameterInspector/ParameterInspector.pri)
|
|
||||||
#include (./MAVLinkInspector/MAVLinkInspector.pri)
|
|
||||||
|
|
||||||
DESTDIR = $$PWD/../bin
|
DESTDIR = $$PWD/../bin
|
||||||
MOC_DIR = $$PWD/../build
|
MOC_DIR = $$PWD/../build
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ void ThreadTemplet::process()//线程函数
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QThread::yieldCurrentThread();
|
QThread::yieldCurrentThread();
|
||||||
|
|
||||||
|
//thread->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,17 +25,19 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void error(QVariant type);
|
Q_INVOKABLE void error(QVariant type);
|
||||||
|
|
||||||
void SendMessageTo(quint8 ch, quint8 *data,quint16 len);
|
Q_INVOKABLE void SendMessageTo(quint8 ch, quint8 *data,quint16 len);
|
||||||
|
|
||||||
void showMessage(const QString &message,int TimeOut = 0);
|
Q_INVOKABLE void showMessage(const QString &message,int TimeOut = 0);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//地面站对外接口
|
//地面站对外接口
|
||||||
void setGCSID(int m_sysid, int m_compid);
|
void setGCSID(int m_sysid, int m_compid);
|
||||||
void setID(int m_sysid,int m_compid);
|
void setID(int m_sysid,int m_compid);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//线程对外接口
|
//线程对外接口
|
||||||
void setRunFrq(qreal frq);
|
void setRunFrq(qreal frq);
|
||||||
void start();
|
void start();
|
||||||
@@ -57,7 +59,7 @@ public slots:
|
|||||||
|
|
||||||
|
|
||||||
//缓存对外接口
|
//缓存对外接口
|
||||||
void setbuff(quint32 src,QByteArray data);
|
Q_INVOKABLE void setbuff(quint32 src,QByteArray data);
|
||||||
void initbuff(void);
|
void initbuff(void);
|
||||||
QByteArray readbuff(quint32 src);
|
QByteArray readbuff(quint32 src);
|
||||||
|
|
||||||
|
|||||||
+1
-7
@@ -15,7 +15,7 @@ DLink::DLink(QObject *parent) : QObject(parent)
|
|||||||
|
|
||||||
//在当前线程运行
|
//在当前线程运行
|
||||||
connect(mavlinknode,SIGNAL(SendMessageTo(quint8,quint8*,quint16)),
|
connect(mavlinknode,SIGNAL(SendMessageTo(quint8,quint8*,quint16)),
|
||||||
this,SLOT(SendMessageTo(quint8,quint8*,quint16)),Qt::BlockingQueuedConnection);//BlockingQueuedConnection);//采用直连的方式,因为是多线程
|
this,SLOT(SendMessageTo(quint8,quint8*,quint16)),Qt::QueuedConnection);//BlockingQueuedConnection);//信号和槽必须在不同的线程中,否则就产生死锁
|
||||||
|
|
||||||
//在当前线程运行
|
//在当前线程运行
|
||||||
connect(mavlinknode,SIGNAL(showMessage(QString,int)),
|
connect(mavlinknode,SIGNAL(showMessage(QString,int)),
|
||||||
@@ -33,8 +33,6 @@ DLink::DLink(QObject *parent) : QObject(parent)
|
|||||||
connect(this,SIGNAL(getRTK(quint32,QByteArray)),
|
connect(this,SIGNAL(getRTK(quint32,QByteArray)),
|
||||||
mavlinknode->rtk,SLOT(setbuff(quint32,QByteArray)),Qt::DirectConnection);
|
mavlinknode->rtk,SLOT(setbuff(quint32,QByteArray)),Qt::DirectConnection);
|
||||||
|
|
||||||
|
|
||||||
mavlinknode->start();
|
|
||||||
//其他协议节点。。。
|
//其他协议节点。。。
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +49,6 @@ DLink::DLink(QObject *parent) : QObject(parent)
|
|||||||
DLink::~DLink()
|
DLink::~DLink()
|
||||||
{
|
{
|
||||||
foreach (serialNode node, serials) {
|
foreach (serialNode node, serials) {
|
||||||
|
|
||||||
if(node.port)
|
if(node.port)
|
||||||
{
|
{
|
||||||
if(node.port->isOpen())
|
if(node.port->isOpen())
|
||||||
@@ -65,9 +62,6 @@ DLink::~DLink()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//mavlinknode->stop();
|
|
||||||
//mavlinknode->deleteLater();
|
|
||||||
|
|
||||||
delete mavlinknode;
|
delete mavlinknode;
|
||||||
mavlinknode = nullptr;
|
mavlinknode = nullptr;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user