! checks whether \c aspect is one of the allowed top level types and has selectable children */
| 306 | and has selectable children |
| 307 | */ |
| 308 | bool TreeViewComboBox::isTopLevel(const AbstractAspect* aspect) const { |
| 309 | const auto& selectableTypes = m_model->selectableAspects(); |
| 310 | for (AspectType type : m_topLevelClasses) { |
| 311 | if (aspect->type() == type) { |
| 312 | // curent aspect is a top level aspect, |
| 313 | // check whether its selectable |
| 314 | if (selectableTypes.indexOf(type) != -1) |
| 315 | return true; |
| 316 | |
| 317 | // check whether the current aspect has selectable children |
| 318 | bool hasSelectableAspects = false; |
| 319 | for (auto selectableType : selectableTypes) { |
| 320 | const auto& children = aspect->children(selectableType, AbstractAspect::ChildIndexFlag::Recursive); |
| 321 | if (!children.isEmpty()) { |
| 322 | hasSelectableAspects = true; |
| 323 | break; |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | return hasSelectableAspects; |
| 328 | } |
| 329 | |
| 330 | if (type == AspectType::XYAnalysisCurve) |
| 331 | if (aspect->inherits(AspectType::XYAnalysisCurve)) |
| 332 | return true; |
| 333 | } |
| 334 | return false; |
| 335 | } |
| 336 | |
| 337 | bool TreeViewComboBox::isHidden(const AbstractAspect* aspect) const { |
| 338 | return (m_hiddenAspects.indexOf(aspect) != -1); |