diff options
author | Andre Hartmann <aha_1980@gmx.de> | 2016-03-29 17:03:46 +0200 |
---|---|---|
committer | André Hartmann <aha_1980@gmx.de> | 2016-05-27 07:10:33 +0000 |
commit | c8667971dea7c38862bd3bf190269072e8c2fe6d (patch) | |
tree | dde4646dc408ec37e5775682e4e638fcb18b68da /examples/serialbus/can/connectdialog.cpp | |
parent | 11c652ddf4883976c4d6930de2785f0fe506aa68 (diff) |
CAN-Example: Add hint to ConnectDialog interface edit
It was really hard to figure out what to put in the interface
edit without deeper knowledge of the backends.
Now the interface edit a placeholder with the first possible
name every time a new backend is selected.
This is thought as a temporary fix, the proper solution
would be to get the possible interfaces from the backends
itself.
Change-Id: I74b5c072d64f7ee98d3fa65e059e6b00c510b308
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'examples/serialbus/can/connectdialog.cpp')
-rw-r--r-- | examples/serialbus/can/connectdialog.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/examples/serialbus/can/connectdialog.cpp b/examples/serialbus/can/connectdialog.cpp index 7495832..1c3ba43 100644 --- a/examples/serialbus/can/connectdialog.cpp +++ b/examples/serialbus/can/connectdialog.cpp @@ -71,7 +71,8 @@ ConnectDialog::ConnectDialog(QWidget *parent) : connect(m_ui->speedBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &ConnectDialog::checkCustomSpeedPolicy); - + connect(m_ui->backendListBox, &QComboBox::currentTextChanged, + this, &ConnectDialog::backendChanged); m_ui->rawFilterEdit->hide(); m_ui->rawFilterLabel->hide(); @@ -102,6 +103,18 @@ void ConnectDialog::checkCustomSpeedPolicy(int idx) } } +void ConnectDialog::backendChanged(const QString &backend) +{ + if (backend == QStringLiteral("generic")) + m_ui->interfaceNameEdit->setPlaceholderText(QStringLiteral("can0")); + else if (backend == QStringLiteral("peakcan")) + m_ui->interfaceNameEdit->setPlaceholderText(QStringLiteral("usbbus1")); + else if (backend == QStringLiteral("socketcan")) + m_ui->interfaceNameEdit->setPlaceholderText(QStringLiteral("can0")); + else if (backend == QStringLiteral("tinycan")) + m_ui->interfaceNameEdit->setPlaceholderText(QStringLiteral("channela")); +} + void ConnectDialog::ok() { updateSettings(); |