diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2016-08-01 10:14:48 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2016-08-01 10:14:48 +0200 |
commit | 2a5d0ab81718d4bbb2bad427edb713753ac979b9 (patch) | |
tree | bbfcf6103a248feb80f8326c1a5c67fea2a819b1 /examples/serialbus/can | |
parent | 84c891ce502c2503f8c6cb808d600e88953aeacb (diff) | |
parent | 398eda8be9eb3415ca44cc35dad3422311d8e221 (diff) |
Merge remote-tracking branch 'gerrit/5.7' into dev
Change-Id: I5202af1faa3b92018747b38fe54524cc712d2f43
Diffstat (limited to 'examples/serialbus/can')
-rw-r--r-- | examples/serialbus/can/mainwindow.cpp | 18 | ||||
-rw-r--r-- | examples/serialbus/can/mainwindow.h | 3 | ||||
-rw-r--r-- | examples/serialbus/can/mainwindow.ui | 24 |
3 files changed, 34 insertions, 11 deletions
diff --git a/examples/serialbus/can/mainwindow.cpp b/examples/serialbus/can/mainwindow.cpp index 3266d79..198ee33 100644 --- a/examples/serialbus/can/mainwindow.cpp +++ b/examples/serialbus/can/mainwindow.cpp @@ -44,6 +44,7 @@ #include <QCanBusFrame> #include <QCanBus> +#include <QCloseEvent> #include <QTimer> #include <QtCore/qbytearray.h> @@ -146,8 +147,15 @@ void MainWindow::connectDevice() m_ui->sendMessagesBox->setEnabled(true); - showStatusMessage(tr("Backend: %1, Connected to: %2") - .arg(p.backendName).arg(p.deviceInterfaceName)); + QVariant bitRate = m_canDevice->configurationParameter(QCanBusDevice::BitRateKey); + if (bitRate.isValid()) { + showStatusMessage(tr("Backend: %1, connected to %2 at %3 kBit/s") + .arg(p.backendName).arg(p.deviceInterfaceName) + .arg(bitRate.toInt() / 1000)); + } else { + showStatusMessage(tr("Backend: %1, connected to %2") + .arg(p.backendName).arg(p.deviceInterfaceName)); + } } } @@ -173,6 +181,12 @@ void MainWindow::framesWritten(qint64 count) qDebug() << "Number of frames written:" << count; } +void MainWindow::closeEvent(QCloseEvent *event) +{ + m_connectDialog->close(); + event->accept(); +} + void MainWindow::checkMessages() { if (!m_canDevice) diff --git a/examples/serialbus/can/mainwindow.h b/examples/serialbus/can/mainwindow.h index aff6c94..de4d442 100644 --- a/examples/serialbus/can/mainwindow.h +++ b/examples/serialbus/can/mainwindow.h @@ -74,6 +74,9 @@ private Q_SLOTS: void disconnectDevice(); void framesWritten(qint64); +protected: + void closeEvent(QCloseEvent *event); + private: void showStatusMessage(const QString &message); void initActionsConnections(); diff --git a/examples/serialbus/can/mainwindow.ui b/examples/serialbus/can/mainwindow.ui index 120f7be..3f74017 100644 --- a/examples/serialbus/can/mainwindow.ui +++ b/examples/serialbus/can/mainwindow.ui @@ -26,7 +26,10 @@ <item row="0" column="0"> <widget class="QLabel" name="label"> <property name="text"> - <string>ID (hex)</string> + <string>&ID (hex)</string> + </property> + <property name="buddy"> + <cstring>idEdit</cstring> </property> </widget> </item> @@ -49,7 +52,7 @@ <item> <widget class="QRadioButton" name="dataFrame"> <property name="text"> - <string>Data</string> + <string>D&ata</string> </property> <property name="checked"> <bool>true</bool> @@ -66,7 +69,7 @@ <item> <widget class="QRadioButton" name="errorFrame"> <property name="text"> - <string>Error</string> + <string>&Error</string> </property> </widget> </item> @@ -76,7 +79,7 @@ <item row="0" column="3"> <widget class="QCheckBox" name="fdBox"> <property name="text"> - <string>Flexible Data-Rate + <string>&Flexible Data-Rate (64 byte payload)</string> </property> </widget> @@ -88,7 +91,7 @@ Otherwise, the standard format with 11 bit idenfier is used.</string> </property> <property name="text"> - <string>Extended Frame + <string>E&xtended Frame (29 bit identifier)</string> </property> </widget> @@ -96,7 +99,7 @@ Otherwise, the standard format with 11 bit idenfier is used.</string> <item row="2" column="3"> <widget class="QPushButton" name="sendButton"> <property name="text"> - <string>send</string> + <string>&Send</string> </property> </widget> </item> @@ -110,7 +113,10 @@ Otherwise, the standard format with 11 bit idenfier is used.</string> <item row="1" column="0"> <widget class="QLabel" name="label_2"> <property name="text"> - <string>Data (hex)</string> + <string>&Data (hex)</string> + </property> + <property name="buddy"> + <cstring>lineEdit</cstring> </property> </widget> </item> @@ -163,7 +169,7 @@ Otherwise, the standard format with 11 bit idenfier is used.</string> <x>0</x> <y>0</y> <width>551</width> - <height>25</height> + <height>21</height> </rect> </property> <widget class="QMenu" name="menuCalls"> @@ -177,7 +183,7 @@ Otherwise, the standard format with 11 bit idenfier is used.</string> </widget> <widget class="QMenu" name="menuHelp"> <property name="title"> - <string>Help</string> + <string>&Help</string> </property> <addaction name="actionAboutQt"/> </widget> |