mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-15 05:22:53 +08:00
Disable editable serial port combo on Windows
This commit is contained in:
parent
920977fa8f
commit
2d8de725b6
@ -77,12 +77,12 @@ Item {
|
||||
enabled: !Cpp_IO_Manager.connected
|
||||
} ComboBox {
|
||||
id: _portCombo
|
||||
editable: true
|
||||
Layout.fillWidth: true
|
||||
opacity: enabled ? 1 : 0.5
|
||||
model: Cpp_IO_Serial.portList
|
||||
enabled: !Cpp_IO_Manager.connected
|
||||
currentIndex: Cpp_IO_Serial.portIndex
|
||||
editable: Qt.platform.os !== "windows"
|
||||
onCurrentIndexChanged: {
|
||||
if (enabled) {
|
||||
if (currentIndex !== Cpp_IO_Serial.portIndex)
|
||||
@ -91,8 +91,8 @@ Item {
|
||||
}
|
||||
|
||||
onAccepted: {
|
||||
if (find(editText) === -1)
|
||||
Cpp_IO_Serial.registerDevice(editText)
|
||||
if (_portCombo.editable && _portCombo.find(_portCombo.editText) === -1)
|
||||
Cpp_IO_Serial.registerDevice(_portCombo.editText)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -724,7 +724,13 @@ void IO::Drivers::Serial::refreshSerialDevices()
|
||||
// Search for available ports and add them to the lsit
|
||||
auto validPortList = validPorts();
|
||||
Q_FOREACH (QSerialPortInfo info, validPortList)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
ports.append(info.portName());
|
||||
#else
|
||||
ports.append(info.systemLocation());
|
||||
#endif
|
||||
}
|
||||
|
||||
// Update list only if necessary
|
||||
if (portList() != ports)
|
||||
|
Loading…
x
Reference in New Issue
Block a user