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

Method layoutChanged

src/frontend/dockwidgets/WorksheetDock.cpp:400–438  ·  view source on GitHub ↗

"Layout"-tab

Source from the content-addressed store, hash-verified

398
399//"Layout"-tab
400void WorksheetDock::layoutChanged(int index) {
401 auto layout = static_cast<Worksheet::Layout>(index);
402
403 bool b = (layout != Worksheet::Layout::NoLayout);
404 ui.sbLayoutTopMargin->setEnabled(b);
405 ui.sbLayoutBottomMargin->setEnabled(b);
406 ui.sbLayoutLeftMargin->setEnabled(b);
407 ui.sbLayoutRightMargin->setEnabled(b);
408 ui.sbLayoutHorizontalSpacing->setEnabled(b);
409 ui.sbLayoutVerticalSpacing->setEnabled(b);
410 ui.sbLayoutRowCount->setEnabled(b);
411 ui.sbLayoutColumnCount->setEnabled(b);
412
413 // show the "scale content" option if no layout active
414 ui.lScaleContent->setVisible(!b);
415 ui.chScaleContent->setVisible(!b);
416
417 if (b) {
418 // show grid specific settings if grid layout selected
419 bool grid = (layout == Worksheet::Layout::GridLayout);
420 ui.lGrid->setVisible(grid);
421 ui.lRowCount->setVisible(grid);
422 ui.sbLayoutRowCount->setVisible(grid);
423 ui.lColumnCount->setVisible(grid);
424 ui.sbLayoutColumnCount->setVisible(grid);
425 } else {
426 // no layout selected, hide grid specific settings that were potentially shown before
427 ui.lGrid->setVisible(false);
428 ui.lRowCount->setVisible(false);
429 ui.sbLayoutRowCount->setVisible(false);
430 ui.lColumnCount->setVisible(false);
431 ui.sbLayoutColumnCount->setVisible(false);
432 }
433
434 CONDITIONAL_LOCK_RETURN;
435
436 for (auto* worksheet : m_worksheetList)
437 worksheet->setLayout(layout);
438}
439
440void WorksheetDock::layoutTopMarginChanged(double margin) {
441 CONDITIONAL_RETURN_NO_LOCK;

Callers

nothing calls this directly

Calls 3

setLayoutMethod · 0.80
setEnabledMethod · 0.45
setVisibleMethod · 0.45

Tested by

no test coverage detected