* @brief Appends action tree items, filtered by the current search query. */
| 1484 | * @brief Appends action tree items, filtered by the current search query. |
| 1485 | */ |
| 1486 | void DataModel::ProjectEditor::appendActionTreeItems(QStandardItem* root) |
| 1487 | { |
| 1488 | Q_ASSERT(root != nullptr); |
| 1489 | |
| 1490 | const QString q = m_treeSearchQuery.trimmed(); |
| 1491 | const bool filterActive = !q.isEmpty(); |
| 1492 | const auto& actions = DataModel::ProjectModel::instance().actions(); |
| 1493 | |
| 1494 | for (const auto& action : actions) { |
| 1495 | if (filterActive && !action.title.contains(q, Qt::CaseInsensitive)) |
| 1496 | continue; |
| 1497 | |
| 1498 | auto* actionItem = new QStandardItem(action.title); |
| 1499 | actionItem->setData(-1, TreeViewFrameIndex); |
| 1500 | actionItem->setData("qrc:/icons/project-editor/treeview/action.svg", TreeViewIcon); |
| 1501 | actionItem->setData(action.title, TreeViewText); |
| 1502 | actionItem->setData(KindAction, TreeItemKind); |
| 1503 | actionItem->setData(action.actionId, TreeItemId); |
| 1504 | actionItem->setData(-1, TreeItemParentId); |
| 1505 | root->appendRow(actionItem); |
| 1506 | m_actionItems.insert(actionItem, action); |
| 1507 | } |
| 1508 | } |
| 1509 | |
| 1510 | /** |
| 1511 | * @brief Appends dataset children of a group, filtered by the current search query. |