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

Method pageChanged

src/frontend/dockwidgets/WorksheetDock.cpp:355–381  ·  view source on GitHub ↗

! * \brief called when one of the standard page sizes was changed * \param i - index of the page size in the combobox */

Source from the content-addressed store, hash-verified

353 * \param i - index of the page size in the combobox
354 */
355void WorksheetDock::pageChanged(int i) {
356 CONDITIONAL_LOCK_RETURN;
357
358 // determine the width and the height of the to be used predefined layout
359 const auto index = ui.cbPage->itemData(i).value<QPageSize::PageSizeId>();
360 QSizeF s = QPageSize::size(index, QPageSize::Millimeter);
361 if (ui.cbOrientation->currentIndex() == 1)
362 s.transpose();
363
364 // s is in mm, in UI we show everything in cm/in
365 if (m_units == Units::Metric) {
366 ui.sbWidth->setValue(roundValue(s.width() / 10.));
367 ui.sbHeight->setValue(roundValue(s.height() / 10.));
368 } else {
369 ui.sbWidth->setValue(roundValue(s.width() / (GSL_CONST_CGS_INCH * Worksheet::convertToSceneUnits(1., Worksheet::Unit::Millimeter))));
370 ui.sbHeight->setValue(roundValue(s.height() / (GSL_CONST_CGS_INCH * Worksheet::convertToSceneUnits(1., Worksheet::Unit::Millimeter))));
371 }
372
373 const double w = Worksheet::convertToSceneUnits(s.width(), Worksheet::Unit::Millimeter);
374 const double h = Worksheet::convertToSceneUnits(s.height(), Worksheet::Unit::Millimeter);
375 for (auto* worksheet : m_worksheetList) {
376 worksheet->beginMacro(i18n("%1: set page size", worksheet->name()));
377 worksheet->setUseViewSize(false);
378 worksheet->setPageRect(QRectF(0, 0, w, h));
379 worksheet->endMacro();
380 }
381}
382
383/*!
384 * \brief called when the width or the height of the page was changed manually

Callers 1

orientationChangedMethod · 0.95

Calls 12

sizeFunction · 0.85
QRectFClass · 0.85
transposeMethod · 0.80
heightMethod · 0.80
beginMacroMethod · 0.80
setUseViewSizeMethod · 0.80
setPageRectMethod · 0.80
endMacroMethod · 0.80
currentIndexMethod · 0.45
setValueMethod · 0.45
widthMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected