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

Method wireActionSignals

app/src/DataModel/ProjectEditor.cpp:488–521  ·  view source on GitHub ↗

* @brief Wires ProjectModel action add/delete signals into selection bookkeeping. */

Source from the content-addressed store, hash-verified

486 * @brief Wires ProjectModel action add/delete signals into selection bookkeeping.
487 */
488void DataModel::ProjectEditor::wireActionSignals()
489{
490 auto& pm = DataModel::ProjectModel::instance();
491
492 connect(
493 &pm,
494 &DataModel::ProjectModel::actionAdded,
495 this,
496 [this](int actionId) {
497 if (!m_selectionModel)
498 return;
499
500 for (auto it = m_actionItems.begin(); it != m_actionItems.end(); ++it) {
501 if (it.value().actionId != actionId)
502 continue;
503
504 m_selectionModel->setCurrentIndex(it.key()->index(), QItemSelectionModel::ClearAndSelect);
505 break;
506 }
507 },
508 Qt::QueuedConnection);
509
510 connect(
511 &pm,
512 &DataModel::ProjectModel::actionDeleted,
513 this,
514 [this] {
515 if (m_selectionModel) {
516 auto index = m_treeModel->index(0, 0);
517 m_selectionModel->setCurrentIndex(index, QItemSelectionModel::ClearAndSelect);
518 }
519 },
520 Qt::QueuedConnection);
521}
522
523/**
524 * @brief Wires ProjectModel output-widget add/delete signals into selection bookkeeping.

Callers

nothing calls this directly

Calls 4

beginMethod · 0.80
setCurrentIndexMethod · 0.80
keyMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected