Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-103895

Setting PageOrientation in Qt 5.x - Qt6.x

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.12.4, 6.0, 6.3
    • GUI: Printing
    • None
    • Windows

    Description

      Pre 6.x settting printer's page orienation is easy:

      QPrinter printer;
      printer.setPageOrientation (QPrinter::Landscape);
      

      This member is removed in 6.x. Code should be replaced by

        QPrinter printer(QPrinter::HighResolution);
        QPageLayout l (printer.pageLayout ());
        // the margins of l are zero here, too small for the next statement:
        l.setOrientation (QPageLayout::Landscape);
        if (printer.setPageLayout (l))
          qDebug () << "Landscape succeeded";
        else
          qDebug () << "Landscape failed";
      

      setPageLayout fails, for no explicit printer margins are given and

      QPlatformPrintDevice::isValidPageLayout

      checks the bounds for the margin during setPageLayout.

      QPrinter::setFullPage, one can virtually print on the whole page.

      Retrieving the minimal or sufficient printmargins for the printer, is done internally, but doesn't seem easily available by public members.

      I don't understand why QPlatformPrintDevice::isValidPageLayout need to be checked here.

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            johnlayt John Layt
            skmyro Geert Mys
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes