Results 1 to 3 of 3

Thread: Printing Screenshot -> poor quality

  1. #1
    Join Date
    May 2007
    Location
    Hannover; Germany
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Printing Screenshot -> poor quality

    Hello,

    i am trying to print a screenshot, but the print has a poor quality. is there a way to scale and print an image in high quality.

    Qt Code:
    1. void Window::printScreenshot()
    2. {
    3. imageLabel->setPixmap(QPixmap::grabWindow(QApplication::desktop()->winId()));
    4.  
    5. Q_ASSERT(imageLabel->pixmap());
    6. QPrintDialog dialog(&printer, 0);
    7. if (dialog.exec()) {
    8. QPainter painter(&printer);
    9. QRect rect = painter.viewport();
    10. QSize size = imageLabel->pixmap()->size();
    11. size.scale(rect.size(), Qt::KeepAspectRatio);
    12. imageLabel->resize(size.width(), size.height());
    13. painter.setViewport(rect.x(), rect.y(), size.width(), size.height());
    14. painter.setWindow(imageLabel->pixmap()->rect());
    15. painter.drawPixmap(0, 0, *imageLabel->pixmap());
    16. }
    17. }
    To copy to clipboard, switch view to plain text mode 

    Kind regards

    Marc Schubert

    PS: excuse my english
    Last edited by wysota; 12th May 2007 at 12:00. Reason: Changed [qtclass] to [code]

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Printing Screenshot -> poor quality

    See QPrinter::setResolution.

    Uwe

  3. #3
    Join Date
    May 2007
    Location
    Hannover; Germany
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Printing Screenshot -> poor quality

    thank you .. it works

Similar Threads

  1. Re: Printing in Qt
    By Jimmy2775 in forum Newbie
    Replies: 3
    Last Post: 12th July 2006, 23:00
  2. Replies: 0
    Last Post: 28th June 2006, 20:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.