MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / buildEditorWidgets

Method buildEditorWidgets

app/src/MQTT/PublisherScriptEditor.cpp:76–104  ·  view source on GitHub ↗

* @brief Allocates the editor + combobox widgets and seeds the template list. */

Source from the content-addressed store, hash-verified

74 * @brief Allocates the editor + combobox widgets and seeds the template list.
75 */
76void MQTT::PublisherScriptEditor::buildEditorWidgets()
77{
78 m_editor = new QCodeEditor(this);
79 m_editor->setTabReplace(true);
80 m_editor->setTabReplaceSize(2);
81 m_editor->setAutoIndentation(true);
82 m_editor->setFont(Misc::CommonFonts::instance().monoFont());
83 m_editor->setMinimumHeight(220);
84 m_editor->setLayoutDirection(Qt::LeftToRight);
85
86 m_languageCombo = new QComboBox(this);
87 m_languageCombo->addItems({tr("JavaScript"), tr("Lua")});
88
89 m_templateCombo = new QComboBox(this);
90 buildTemplates();
91
92 m_testInput = new QLineEdit(this);
93 m_testInput->setPlaceholderText(tr("Sample frame bytes (text or hex)"));
94 m_testOutput = new QLineEdit(QStringLiteral("--"), this);
95 m_testOutput->setReadOnly(true);
96 m_testOutput->setMinimumWidth(160);
97
98 m_hexCheckBox = new QCheckBox(tr("Hex"), this);
99 m_testButton = new QPushButton(tr("Test"), this);
100 m_clearButton = new QPushButton(tr("Clear"), this);
101
102 m_applyButton = new QPushButton(tr("Apply"), this);
103 m_cancelButton = new QPushButton(tr("Cancel"), this);
104}
105
106/**
107 * @brief Builds the language + template selector toolbar row.

Callers

nothing calls this directly

Calls 4

setTabReplaceMethod · 0.80
setTabReplaceSizeMethod · 0.80
setAutoIndentationMethod · 0.80
setFontMethod · 0.80

Tested by

no test coverage detected