mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-31 17:42:55 +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
|
enabled: !Cpp_IO_Manager.connected
|
||||||
} ComboBox {
|
} ComboBox {
|
||||||
id: _portCombo
|
id: _portCombo
|
||||||
editable: true
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
opacity: enabled ? 1 : 0.5
|
opacity: enabled ? 1 : 0.5
|
||||||
model: Cpp_IO_Serial.portList
|
model: Cpp_IO_Serial.portList
|
||||||
enabled: !Cpp_IO_Manager.connected
|
enabled: !Cpp_IO_Manager.connected
|
||||||
currentIndex: Cpp_IO_Serial.portIndex
|
currentIndex: Cpp_IO_Serial.portIndex
|
||||||
|
editable: Qt.platform.os !== "windows"
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
if (currentIndex !== Cpp_IO_Serial.portIndex)
|
if (currentIndex !== Cpp_IO_Serial.portIndex)
|
||||||
@ -91,8 +91,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
if (find(editText) === -1)
|
if (_portCombo.editable && _portCombo.find(_portCombo.editText) === -1)
|
||||||
Cpp_IO_Serial.registerDevice(editText)
|
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
|
// Search for available ports and add them to the lsit
|
||||||
auto validPortList = validPorts();
|
auto validPortList = validPorts();
|
||||||
Q_FOREACH (QSerialPortInfo info, validPortList)
|
Q_FOREACH (QSerialPortInfo info, validPortList)
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
ports.append(info.portName());
|
||||||
|
#else
|
||||||
ports.append(info.systemLocation());
|
ports.append(info.systemLocation());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Update list only if necessary
|
// Update list only if necessary
|
||||||
if (portList() != ports)
|
if (portList() != ports)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user