summaryrefslogtreecommitdiffstats
path: root/examples/serialbus/can/sendframebox.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-11-20 13:18:03 +0100
committerLiang Qi <liang.qi@qt.io>2017-11-20 13:18:03 +0100
commit2caa6e1ca0094b2e2a4cd6005836d46a7ddfdf6a (patch)
treee2653c5aeda85ef44a174a467319b8142aa958bf /examples/serialbus/can/sendframebox.cpp
parent0f33c698229ebb418b71a19dd409e2b5a417182e (diff)
parent50e4edb4b23947f9fcdb99ea0101660f0752cc1f (diff)
Merge remote-tracking branch 'origin/5.10' into dev
Diffstat (limited to 'examples/serialbus/can/sendframebox.cpp')
-rw-r--r--examples/serialbus/can/sendframebox.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/examples/serialbus/can/sendframebox.cpp b/examples/serialbus/can/sendframebox.cpp
index a84222d..117ff10 100644
--- a/examples/serialbus/can/sendframebox.cpp
+++ b/examples/serialbus/can/sendframebox.cpp
@@ -1,12 +1,22 @@
/****************************************************************************
**
** Copyright (C) 2017 Andre Hartmann <aha_1980@gmx.de>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the QtSerialBus module.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
@@ -157,6 +167,15 @@ SendFrameBox::SendFrameBox(QWidget *parent) :
m_ui->bitrateSwitchBox->setChecked(false);
});
+ auto frameIdTextChanged = [this]() {
+ const bool hasFrameId = !m_ui->frameIdEdit->text().isEmpty();
+ m_ui->sendButton->setEnabled(hasFrameId);
+ m_ui->sendButton->setToolTip(hasFrameId
+ ? QString() : tr("Cannot send because no Frame ID was given."));
+ };
+ connect(m_ui->frameIdEdit, &QLineEdit::textChanged, frameIdTextChanged);
+ frameIdTextChanged();
+
connect(m_ui->sendButton, &QPushButton::clicked, [this]() {
const uint frameId = m_ui->frameIdEdit->text().toUInt(nullptr, 16);
QString data = m_ui->payloadEdit->text();