! * \brief called when one of the standard page sizes was changed * \param i - index of the page size in the combobox */
| 353 | * \param i - index of the page size in the combobox |
| 354 | */ |
| 355 | void 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 |
no test coverage detected