Results 1 to 3 of 3

Thread: How do I use QPixmap::grabWindow with offscreen (QScrollArea) regions ?

  1. #1
    Join Date
    Apr 2011
    Posts
    61
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default How do I use QPixmap::grabWindow with offscreen (QScrollArea) regions ?

    How can I grab an entire window that is inside a scrollarea ?
    My content inside it have more than 1600x1200.
    The content is a flash app and I can scroll it, but want to grab the entire content to save it.
    And QPixmap::grabWidget doesn't work too.
    Last edited by rsilva; 24th April 2011 at 03:28.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How do I use QPixmap::grabWindow with offscreen (QScrollArea) regions ?

    See QWidget::render(). There is also an example for your situation!

  3. #3
    Join Date
    Apr 2011
    Posts
    61
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How do I use QPixmap::grabWindow with offscreen (QScrollArea) regions ?

    I've tried it yesterday when I found it, but, it don't capture the Flash content in the WebView.
    Qt Code:
    1. void Standalone::screenShot_VirtualScreen()
    2. {
    3. QImage img(ui->webView->page()->mainFrame()->contentsSize(), QImage::Format_ARGB32_Premultiplied);
    4. img.fill(Qt::transparent);
    5.  
    6. QPainter painter(&img);
    7. painter.setRenderHint(QPainter::Antialiasing, true);
    8. painter.setRenderHint(QPainter::TextAntialiasing, true);
    9. painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
    10. ui->webView->render(&painter);
    11. painter.end();
    12.  
    13. img.save(screenShotPath(), "PNG");
    14. }
    To copy to clipboard, switch view to plain text mode 

    It's only give me a "empty" (background-color) image, and not the content.

Similar Threads

  1. Free memory - QPixmap::grabWindow?
    By hakermania in forum Newbie
    Replies: 3
    Last Post: 18th April 2011, 16:10
  2. QPixmap::grabWindow does not work on some machines!
    By dima72 in forum Qt Programming
    Replies: 3
    Last Post: 26th July 2010, 07:02
  3. QPixmap::grabWindow() problem
    By mtroscheck in forum Qt Programming
    Replies: 1
    Last Post: 7th February 2009, 00:15
  4. Replies: 1
    Last Post: 21st August 2008, 07:44
  5. QPixmap::grabWindow too slow
    By niko in forum Newbie
    Replies: 2
    Last Post: 31st August 2006, 06:40

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.