summaryrefslogtreecommitdiffstats
path: root/examples/serialbus/can/sendframebox.cpp
diff options
context:
space:
mode:
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();