From 99bb58adf93b6f433e6ae8c4e5cb60a743654cfe Mon Sep 17 00:00:00 2001 From: wh201906 Date: Sun, 4 Jun 2023 19:10:03 +0800 Subject: [PATCH] Fix the user input for "Port" Port can be something not listed in the combobox, like tcp:192.168.xxx.xxx:xxxxx(25 characters) bt:aa:bb:cc:dd:ee:ff(20 characters) --- src/ui/mainwindow.cpp | 10 +++++++++- src/ui/mainwindow.ui | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index f07f3d9..f80cf5b 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -158,7 +158,15 @@ void MainWindow::on_PM3_connectButton_clicked() { qDebug() << "Main:" << QThread::currentThread(); - QString port = ui->PM3_portBox->currentData().toString(); + const QComboBox* portBox = ui->PM3_portBox; + QString port; + if(portBox->currentText() == portBox->itemText(portBox->currentIndex())) + // in the list + port = portBox->currentData().toString(); + else + // not in the list + port = portBox->currentText(); + qDebug() << "port:" << port; QString startArgs = ui->Set_Client_startArgsEdit->text(); QString clientPath = ui->PM3_pathBox->currentText(); QFileInfo clientFile(clientPath); diff --git a/src/ui/mainwindow.ui b/src/ui/mainwindow.ui index 967b6e9..2c19ef0 100644 --- a/src/ui/mainwindow.ui +++ b/src/ui/mainwindow.ui @@ -94,6 +94,9 @@ true + + 15 +