终端,上下键修正

This commit is contained in:
hm
2020-12-16 18:39:22 +08:00
parent b249343f54
commit 0a2695a2dd
11 changed files with 32 additions and 13 deletions
@@ -86,7 +86,7 @@ void ConnectDialog::setInit(QVariant inter, QVariant device)
if((m_Type == inter)&&(m_Param1.toString().size() > 0))//说明有数 if((m_Type == inter)&&(m_Param1.toString().size() > 0))//说明有数
{ {
qDebug() << "fund old setting" << m_Type; qDebug() << "found old setting" << m_Type;
isNew = false; isNew = false;
} }
+15 -2
View File
@@ -49,6 +49,7 @@ Tools_Index3::Tools_Index3(QWidget *parent) :
ui->comboBox_EndType->addItem("CRLF","\r\n"); ui->comboBox_EndType->addItem("CRLF","\r\n");
ui->comboBox_EndType->addItem("LF","\n"); ui->comboBox_EndType->addItem("LF","\n");
ui->comboBox_EndType->addItem("CR","\r");
ui->comboBox_EndType->setCurrentIndex(1); ui->comboBox_EndType->setCurrentIndex(1);
} }
@@ -100,8 +101,10 @@ void Tools_Index3::setFloat(void)
else else
{ {
this->setParent(m_parent); this->setParent(m_parent);
this->move(0,0); this->move(0,0);
this->hide(); this->hide();
update();
} }
} }
@@ -129,6 +132,8 @@ void Tools_Index3::keyPressEvent(QKeyEvent *event) //键盘按下事件
QString msg; QString msg;
msg = History.at(HistoryCount); msg = History.at(HistoryCount);
ui->lineEdit->setText(msg); ui->lineEdit->setText(msg);
} }
}break; }break;
@@ -141,6 +146,11 @@ void Tools_Index3::keyPressEvent(QKeyEvent *event) //键盘按下事件
HistoryCount ++; HistoryCount ++;
} }
if(HistoryCount >= History.size())
{
return;
}
QString msg; QString msg;
msg = History.at(HistoryCount); msg = History.at(HistoryCount);
ui->lineEdit->setText(msg); ui->lineEdit->setText(msg);
@@ -174,7 +184,7 @@ void Tools_Index3::Transmit(QString msg)
} }
History.append(msg); History.append(msg);
HistoryCount = History.size() - 1; HistoryCount = History.size();
msg.append(EndChar); msg.append(EndChar);
@@ -214,4 +224,7 @@ void Tools_Index3::on_comboBox_EndType_currentIndexChanged(int index)
EndChar.append(ui->comboBox_EndType->currentData().toString()); EndChar.append(ui->comboBox_EndType->currentData().toString());
} }
void Tools_Index3::on_pushButton_ClearWindow_clicked()
{
ui->textBrowser->clear();
}
+3 -1
View File
@@ -55,6 +55,8 @@ private slots:
void on_comboBox_EndType_currentIndexChanged(int index); void on_comboBox_EndType_currentIndexChanged(int index);
void on_pushButton_ClearWindow_clicked();
private: private:
Ui::Tools_Index3 *ui; Ui::Tools_Index3 *ui;
QWidget *m_parent; QWidget *m_parent;
@@ -63,7 +65,7 @@ private:
QStringList History; QStringList History;
int64_t HistoryCount; int64_t HistoryCount = 0;
}; };
+2 -8
View File
@@ -50,6 +50,8 @@ void terminal::stop()
<< QThread::currentThread() << QThread::currentThread()
<< "running state:" << "running state:"
<< running_flag; << running_flag;
disconnect(thread, nullptr, nullptr, nullptr);
} }
else else
{ {
@@ -185,14 +187,6 @@ void terminal::serial_control(void)
serial_control.device = SERIAL_CONTROL_DEV_SHELL; serial_control.device = SERIAL_CONTROL_DEV_SHELL;
serial_control.timeout = 5000; serial_control.timeout = 5000;
qDebug() << serial_control.baudrate
<< serial_control.count
<< serial_control.data
<< serial_control.device
<< serial_control.flags
<< serial_control.timeout;
mavlink_msg_serial_control_encode(Current_sysID,Current_CompID, &msg,&serial_control); mavlink_msg_serial_control_encode(Current_sysID,Current_CompID, &msg,&serial_control);
SendMessage(msg); SendMessage(msg);
} }
+1
View File
@@ -53,6 +53,7 @@ void commandprocess::stop()
<< QThread::currentThread() << QThread::currentThread()
<< "running state:" << "running state:"
<< running_flag; << running_flag;
disconnect(thread, nullptr, nullptr, nullptr);
} }
else else
{ {
+2
View File
@@ -383,6 +383,8 @@ void MavLinkNode::stop()
<< QThread::currentThread() << QThread::currentThread()
<< "running state:" << "running state:"
<< running_flag; << running_flag;
disconnect(thread, nullptr, nullptr, nullptr);
} }
else else
{ {
+1
View File
@@ -49,6 +49,7 @@ void MissionProcess::stop()
<< QThread::currentThread() << QThread::currentThread()
<< "running state:" << "running state:"
<< running_flag; << running_flag;
disconnect(thread, nullptr, nullptr, nullptr);
} }
else else
{ {
+1
View File
@@ -49,6 +49,7 @@ void ParameterProcess::stop()
<< QThread::currentThread() << QThread::currentThread()
<< "running state:" << "running state:"
<< running_flag; << running_flag;
disconnect(thread, nullptr, nullptr, nullptr);
} }
else else
{ {
+1
View File
@@ -93,6 +93,7 @@ void Replay::stop()
<< QThread::currentThread() << QThread::currentThread()
<< "running state:" << "running state:"
<< running_flag; << running_flag;
disconnect(thread, nullptr, nullptr, nullptr);
} }
else else
{ {
+4
View File
@@ -52,6 +52,9 @@ void statusprocess::stop()
<< QThread::currentThread() << QThread::currentThread()
<< "running state:" << "running state:"
<< running_flag; << running_flag;
disconnect(thread, nullptr, nullptr, nullptr);
} }
else else
{ {
@@ -87,6 +90,7 @@ void statusprocess::process()//线程函数
} }
} }
//退出线程 //退出线程
disconnect(thread, nullptr, nullptr, nullptr);
thread->quit(); thread->quit();
//thread->wait(200);//等待结束 //thread->wait(200);//等待结束
thread->deleteLater(); thread->deleteLater();
+1 -1
View File
@@ -118,7 +118,7 @@ signals:
private: private:
bool running_flag = false; bool running_flag = false;
quint32 running_frq = 200;//200Hz quint32 running_frq = 10;//200Hz
QThread *thread = nullptr; QThread *thread = nullptr;
//目标id //目标id