* @brief Switches the form to the GroupView for the clicked group item. */
| 5121 | * @brief Switches the form to the GroupView for the clicked group item. |
| 5122 | */ |
| 5123 | bool DataModel::ProjectEditor::selectGroupItem(QStandardItem* item) |
| 5124 | { |
| 5125 | if (!m_groupItems.contains(item)) |
| 5126 | return false; |
| 5127 | |
| 5128 | auto& pm = DataModel::ProjectModel::instance(); |
| 5129 | const auto cached = m_groupItems.value(item); |
| 5130 | const auto& groups = pm.groups(); |
| 5131 | DataModel::Group live = cached; |
| 5132 | if (cached.groupId >= 0 && static_cast<size_t>(cached.groupId) < groups.size()) |
| 5133 | live = groups[cached.groupId]; |
| 5134 | |
| 5135 | pm.setSelectedGroup(live); |
| 5136 | setCurrentView(GroupView); |
| 5137 | buildGroupModel(live); |
| 5138 | return true; |
| 5139 | } |
| 5140 | |
| 5141 | /** |
| 5142 | * @brief Routes the Groups root and group folder items to their navigable views. |
nothing calls this directly
no test coverage detected