diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2023-02-07 12:48:00 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-02-14 15:14:22 +0000 |
commit | 8951ade54136aa8ddef516d411f5f28321213207 (patch) | |
tree | 170dbd587923ab2ab791438563b98237a862743c | |
parent | ed51686f09288850948aa9be445f399daf2fb80f (diff) |
Custom Command Example: improve UI
* Disable address&port line edit when the connection is established.
* Add a tooltip for the expected contents of the address & port edit.
* Update default TCP port to 50200 so that it does not require ROOT
privileges on Linux.
* Update MainWindow title
Task-number: QTBUG-110890
Change-Id: I92a08a693b20510a260b4a09bfcdd68a4f6042a2
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit db59ba7847dd3784f9712c903852f3df0c5beeab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | examples/serialbus/modbus/custom/mainwindow.cpp | 3 | ||||
-rw-r--r-- | examples/serialbus/modbus/custom/mainwindow.ui | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/examples/serialbus/modbus/custom/mainwindow.cpp b/examples/serialbus/modbus/custom/mainwindow.cpp index d0a5600..34d3f17 100644 --- a/examples/serialbus/modbus/custom/mainwindow.cpp +++ b/examples/serialbus/modbus/custom/mainwindow.cpp @@ -15,6 +15,8 @@ MainWindow::MainWindow(QWidget* parent) ui->setupUi(this); ui->statusbar->setSizeGripEnabled(false); + ui->addressPort->setToolTip(tr("Enter <ip address>:<port> pair.")); + setupConnections(); setupClientContainer(); setupServerContainer(); @@ -88,6 +90,7 @@ void MainWindow::onConnectButtonClicked() void MainWindow::onStateChanged(int state) { ui->serverAddress->setEnabled(state == QModbusDevice::UnconnectedState); + ui->addressPort->setEnabled(state == QModbusDevice::UnconnectedState); ui->actionConnect->setEnabled(state == QModbusDevice::UnconnectedState); ui->actionDisconnect->setEnabled(state == QModbusDevice::ConnectedState); diff --git a/examples/serialbus/modbus/custom/mainwindow.ui b/examples/serialbus/modbus/custom/mainwindow.ui index d8e6099..85e02e7 100644 --- a/examples/serialbus/modbus/custom/mainwindow.ui +++ b/examples/serialbus/modbus/custom/mainwindow.ui @@ -17,7 +17,7 @@ </sizepolicy> </property> <property name="windowTitle"> - <string>MainWindow</string> + <string>Modbus Custom Command</string> </property> <widget class="QWidget" name="centralwidget"> <layout class="QGridLayout" name="gridLayout_3"> @@ -39,7 +39,7 @@ </sizepolicy> </property> <property name="text"> - <string>127.0.0.1:502</string> + <string>127.0.0.1:50200</string> </property> </widget> </item> |