MCPcopy Create free account
hub / github.com/KDE/labplot / isTopLevel

Method isTopLevel

src/frontend/widgets/TreeViewComboBox.cpp:308–335  ·  view source on GitHub ↗

! checks whether \c aspect is one of the allowed top level types and has selectable children */

Source from the content-addressed store, hash-verified

306 and has selectable children
307*/
308bool 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
337bool TreeViewComboBox::isHidden(const AbstractAspect* aspect) const {
338 return (m_hiddenAspects.indexOf(aspect) != -1);

Callers

nothing calls this directly

Calls 5

inheritsMethod · 0.80
typeMethod · 0.45
indexOfMethod · 0.45
childrenMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected