File tree Expand file tree Collapse file tree 5 files changed +19
-10
lines changed
Expand file tree Collapse file tree 5 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,9 @@ class CPrintData::CPrintDataPrivate : public QObject
175175
176176 paper_width = std::ceil (size[" w" ].toDouble (0 ));
177177 paper_height = std::ceil (size[" h" ].toDouble (0 ));
178+ if (page_orientation == QPageLayout::Landscape) {
179+ std::swap (paper_width, paper_height);
180+ }
178181 size_preset = size[" preset" ].toString ();
179182 }
180183
Original file line number Diff line number Diff line change @@ -498,13 +498,10 @@ QDialog::DialogCode GtkPrintDialog::exec()
498498 m_printer->setPaperSize (QSizeF (width, height), qt_unit);
499499
500500 GtkPageOrientation orient = gtk_page_setup_get_orientation (page_setup);
501- QPrinter::Orientation orient_arr[2 ] = {
502- QPrinter::Portrait,
503- QPrinter::Landscape
504- };
505- const int print_ornt = (int )orient;
506- m_printer->setOrientation ((print_ornt == 0 || print_ornt == 2 ) ?
507- orient_arr[0 ] : orient_arr[1 ]);
501+ QPageLayout plt = m_printer->pageLayout ();
502+ plt.setOrientation ((orient == GtkPageOrientation::GTK_PAGE_ORIENTATION_PORTRAIT ||
503+ orient == GtkPageOrientation::GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT) ? QPageLayout::Portrait : QPageLayout::Landscape);
504+ m_printer->setPageLayout (plt);
508505 }
509506 break ;
510507 }
Original file line number Diff line number Diff line change @@ -487,7 +487,9 @@ QDialog::DialogCode PrintDialog::exec()
487487 double height = double (pDevmode->dmPaperLength )/10 ;
488488 QPageSize ps (QSizeF (width, height), QPageSize::Millimeter);
489489 m_printer->setPageSize (ps);
490- m_printer->setPageOrientation (pDevmode->dmOrientation == DMORIENT_PORTRAIT ? QPageLayout::Portrait : QPageLayout::Landscape);
490+ QPageLayout plt = m_printer->pageLayout ();
491+ plt.setOrientation (pDevmode->dmOrientation == DMORIENT_PORTRAIT ? QPageLayout::Portrait : QPageLayout::Landscape);
492+ m_printer->setPageLayout (plt);
491493 GlobalUnlock (dlg.hDevMode );
492494 }
493495
Original file line number Diff line number Diff line change @@ -646,8 +646,12 @@ class CEditorWindowPrivate : public CCefEventsGate
646646 }
647647
648648 if ( !AscAppManager::printData ().isQuickPrint () ) {
649- printer->setPageOrientation (AscAppManager::printData ().pageOrientation ());
649+ // printer->setPageOrientation(AscAppManager::printData().pageOrientation());
650650 printer->setPageSize (AscAppManager::printData ().pageSize ());
651+ QPageLayout layout = printer->pageLayout ();
652+ layout.setOrientation (AscAppManager::printData ().pageOrientation ());
653+ printer->setPageLayout (layout);
654+ printer->setFullPage (true );
651655 }
652656
653657#ifdef _WIN32
Original file line number Diff line number Diff line change @@ -1368,8 +1368,11 @@ void CMainWindow::onDocumentPrint(void * opts)
13681368 }
13691369
13701370 if ( !AscAppManager::printData ().isQuickPrint () ) {
1371- printer->setPageOrientation (AscAppManager::printData ().pageOrientation ());
1371+ // printer->setPageOrientation(AscAppManager::printData().pageOrientation());
13721372 printer->setPageSize (AscAppManager::printData ().pageSize ());
1373+ QPageLayout layout = printer->pageLayout ();
1374+ layout.setOrientation (AscAppManager::printData ().pageOrientation ());
1375+ printer->setPageLayout (layout);
13731376 printer->setFullPage (true );
13741377 }
13751378
You can’t perform that action at this time.
0 commit comments