* @brief Wires ProjectModel action add/delete signals into selection bookkeeping. */
| 486 | * @brief Wires ProjectModel action add/delete signals into selection bookkeeping. |
| 487 | */ |
| 488 | void 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. |
nothing calls this directly
no test coverage detected