Results 1 to 3 of 3

Thread: Screenshot of QGraphicsScene with QGraphicsProxyWidget

  1. #1
    Join Date
    Apr 2016
    Posts
    5
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Question Screenshot of QGraphicsScene with QGraphicsProxyWidget

    I have a QGraphicsScene with a few QGraphicsPixmapItems and the QGraphicsProxyWidget added to it. When the screenshot is taken the the QGraphicsProxyWidget doesn't show up in the screenshot.

    The code for the screenshot i tried unsuccessfully are the following :-
    Qt Code:
    1. QPixmap MainWindow::getScreenShot(){
    2. QPixmap screenshotPixmap = ui->graphicsView->grab();
    3. return screenshotPixmap;
    4. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. QPixmap MainWindow::getScreenShot(){
    2. QImage img(scene->sceneRect().size().toSize(), QImage::Format_ARGB32_Premultiplied);
    3. QPainter painter(&img);
    4. //scene->render(&painter);
    5. ui->graphicsView->render(&painter);
    6. QPixmap tempPixmap;
    7. tempPixmap.convertFromImage(img);
    8. return tempPixmap;
    9. }
    To copy to clipboard, switch view to plain text mode 

    What other alternative methods can be used to get the screenshot with the QGraphicsProxyWidget also present in it?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Screenshot of QGraphicsScene with QGraphicsProxyWidget

    I would expected all three methods to work more or less the same.

    So the normal graphics items show up but the proxied widgets do not?
    Which kind of widgets are those?

    Cheers,
    _

  3. #3
    Join Date
    Apr 2016
    Posts
    5
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: Screenshot of QGraphicsScene with QGraphicsProxyWidget

    Hi,

    Yes the QGraphicsPixmapItems show up but the proxy widgets (Few push buttons) don't show up in the screenshot image.

Similar Threads

  1. Take a Screenshot on Android
    By Khachatur in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 10th October 2014, 16:45
  2. How to take ScreenShot Qt/QML
    By stereoMatching in forum Qt Quick
    Replies: 1
    Last Post: 15th June 2013, 10:47
  3. Replies: 8
    Last Post: 9th July 2010, 00:37
  4. Screenshot
    By graciano in forum Qt Programming
    Replies: 3
    Last Post: 19th April 2009, 16:32
  5. Adding QGraphicsProxyWidget items into QGraphicsScene
    By yagabey in forum Qt Programming
    Replies: 3
    Last Post: 21st November 2008, 06:33

Tags for this Thread

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.