Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Help with printing Qpixmap
Forum Updated to NodeBB v4.3 + New Features

Help with printing Qpixmap

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 3.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    buddha
    wrote on last edited by
    #1

    i want to print out Qtableview in QPrintPreviewDialog and this is my code .
    but in QPrintPreviewDialog it show very small
    "picture of my QPrintPreviewDialog ":http://www.xum.ir/images/2014/05/22/print.png
    any body can help me?
    @
    void Report::filePrintPreview(){
    #ifndef QT_NO_PRINTER
    QPrinter printer(QPrinter::HighResolution);
    QPrintPreviewDialog preview(&printer, this);
    preview.setWindowFlags ( Qt::Window );
    connect(&preview, SIGNAL(paintRequested(QPrinter*)), SLOT(printPreview(QPrinter *)));
    preview.exec();
    #endif
    }

    void Report::printPreview(QPrinter *printer){
    QPixmap pixmap(ui->tableView->size());
    ui->tableView->render(&pixmap);
    QPainter painter;
    painter.begin(printer);//p is my QPrinter
    printer->paintEngine()->drawPixmap(QRectF(0, 0, pixmap.width(), pixmap.height()), pixmap, QRectF(0, 0,pixmap.width(), pixmap.height()));
    painter.end();
    }
    @

    1 Reply Last reply
    0
    • B Offline
      B Offline
      buddha
      wrote on last edited by
      #2

      any body can't help me?
      pleeeeeas

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Have a look "here":http://qt-project.org/doc/qt-5/qtprintsupport-index.html#printing-widgets

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • B Offline
          B Offline
          buddha
          wrote on last edited by
          #4

          [quote author="SGaist" date="1400794409"]Hi,

          Have a look "here":http://qt-project.org/doc/qt-5/qtprintsupport-index.html#printing-widgets[/quote]

          I've read this before,
          If possible, read and then answer a question.

          1 Reply Last reply
          0
          • B Offline
            B Offline
            buddha
            wrote on last edited by
            #5

            No one could answer my question?

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved