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

CLONE - QPrintPreviewDialog print just one page doesn't work.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 4.7.0, 5.1.0
    • None
    • Windows XP and Windows 7

    Description

      If I write to the QPainter every thing works fine.
      But if I like to print just the second site all sites will be printed.

      void UPrintTextEditor::onPrint(){
      QPrinter printer(QPrinter::ScreenResolution);
      printer.setPageSize(QPrinter::A4);
      printer.setOrientation(QPrinter::Landscape);
      printer.setPageOrder(QPrinter::FirstPageFirst);

      QPrintPreviewDialog preview(&printer);
      connect(&preview, SIGNAL(paintRequested(QPrinter*)), SLOT(onPrint(QPrinter*)));
      preview.exec();
      }

      void UPrintTextEditor::onPrint(QPrinter *printer){
      QPainter painter;

      painter.begin(printer);

      for(int i = 1; i <= 3; i++)

      { painter.drawText(QRectF(10.0, 10.0, 100.0, 100.0), QString::number(i) + ". Page"); if(i < 3) printer->newPage(); }

      painter.end();
      }

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            aliks-os Aleksey Osipov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes