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

Method prepareDrawingOrderMenu

src/backend/worksheet/WorksheetElement.cpp:312–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310}
311
312void WorksheetElement::prepareDrawingOrderMenu() {
313 const auto* parent = parentAspect();
314 const int index = parent->indexOfChild<AbstractAspect>(this, ChildIndexFlag::IncludeHidden);
315 const auto& children = parent->children<AbstractAspect>(ChildIndexFlag::IncludeHidden);
316
317 //"move behind" sub-menu
318 m_moveBehindMenu->clear();
319 for (int i = 0; i < index; ++i) {
320 const auto* elem = children.at(i);
321 if (elem->isHidden())
322 continue;
323 // axes and legends are always drawn on top of other elements, don't add them to the menu
324 if (elem->type() != AspectType::Axis && elem->type() != AspectType::CartesianPlotLegend) {
325 auto* action = m_moveBehindMenu->addAction(elem->icon(), elem->name());
326 action->setData(i);
327 }
328 }
329
330 //"move in front of" sub-menu
331 m_moveInFrontOfMenu->clear();
332 for (int i = index + 1; i < children.size(); ++i) {
333 const auto* elem = children.at(i);
334 if (elem->isHidden())
335 continue;
336 // axes and legends are always drawn on top of other elements, don't add them to the menu
337 if (elem->type() != AspectType::Axis && elem->type() != AspectType::CartesianPlotLegend) {
338 auto* action = m_moveInFrontOfMenu->addAction(elem->icon(), elem->name());
339 action->setData(i);
340 }
341 }
342
343 // hide the sub-menus if they don't have any entries
344 m_moveInFrontOfMenu->menuAction()->setVisible(!m_moveInFrontOfMenu->isEmpty());
345 m_moveBehindMenu->menuAction()->setVisible(!m_moveBehindMenu->isEmpty());
346}
347
348void WorksheetElement::execMoveInFrontOf(QAction* action) {
349 auto* parent = parentAspect();

Callers 2

prepareDrawingMenuMethod · 0.80

Calls 9

clearMethod · 0.45
isHiddenMethod · 0.45
typeMethod · 0.45
iconMethod · 0.45
nameMethod · 0.45
setDataMethod · 0.45
sizeMethod · 0.45
setVisibleMethod · 0.45
isEmptyMethod · 0.45

Tested by 2

prepareDrawingMenuMethod · 0.64