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.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/serialbus/can/sendframebox.cpp b/examples/serialbus/can/sendframebox.cpp
index a84222d..d7a25ba 100644
--- a/examples/serialbus/can/sendframebox.cpp
+++ b/examples/serialbus/can/sendframebox.cpp
@@ -157,6 +157,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();