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)
master
wh201906 2 years ago
parent 785fde6e2d
commit 99bb58adf9
No known key found for this signature in database

@ -158,7 +158,15 @@ void MainWindow::on_PM3_connectButton_clicked()
{ {
qDebug() << "Main:" << QThread::currentThread(); 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 startArgs = ui->Set_Client_startArgsEdit->text();
QString clientPath = ui->PM3_pathBox->currentText(); QString clientPath = ui->PM3_pathBox->currentText();
QFileInfo clientFile(clientPath); QFileInfo clientFile(clientPath);

@ -94,6 +94,9 @@
<property name="editable"> <property name="editable">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="minimumContentsLength">
<number>15</number>
</property>
</widget> </widget>
</item> </item>
<item> <item>

Loading…
Cancel
Save