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

Method readCode

app/src/DataModel/Editors/OutputCodeEditor.cpp:314–334  ·  view source on GitHub ↗

* @brief Loads the transmit function from the currently selected output widget. */

Source from the content-addressed store, hash-verified

312 * @brief Loads the transmit function from the currently selected output widget.
313 */
314void DataModel::OutputCodeEditor::readCode()
315{
316 if (m_readingCode)
317 return;
318
319 m_readingCode = true;
320
321 auto& editor = DataModel::ProjectEditor::instance();
322 const auto& sel = editor.selectedOutputWidget();
323
324 QString code = sel.transmitFunction;
325 if (code.isEmpty())
326 code = defaultTemplate();
327
328 m_widget.setPlainText(code);
329 m_widget.document()->clearUndoRedoStacks();
330 m_widget.document()->setModified(false);
331
332 m_readingCode = false;
333 Q_EMIT modifiedChanged();
334}
335
336/**
337 * @brief Shows a dialog to pick and load a built-in template.

Callers

nothing calls this directly

Calls 2

isEmptyMethod · 0.80
setModifiedMethod · 0.80

Tested by

no test coverage detected