Results 1 to 2 of 2

Thread: Display of a widget into an image file?

  1. #1
    Join Date
    Nov 2009
    Location
    Laval, France
    Posts
    124
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Display of a widget into an image file?

    I want to take advantage of features such as layouts, size policies and so on to do some drawing based on an assembly of nested widgets. Instead of displaying on the screen
    I'd like to display into an image file or a QImage object, so I can save it as a file in a variety of formats. Is there any way of doing this?
    Last edited by feraudyh; 16th April 2017 at 18:01. Reason: spelling corrections

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Display of a widget into an image file?

    Yes, you can use QWidget::render() to save a snapshot of a widget as an image however usually this is not a recommended approach. It might be easier for you to use what QGraphicsView framework offers (you can render a scene into an image using QGraphicsScene::render()).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Processing and Displaying Image on Widget
    By mhb88 in forum Qt Programming
    Replies: 13
    Last Post: 15th April 2016, 10:24
  2. Replies: 10
    Last Post: 4th July 2013, 12:53
  3. Replies: 6
    Last Post: 2nd May 2011, 09:43
  4. Background image of widget in QWidgetStack
    By el33t in forum Qt Programming
    Replies: 9
    Last Post: 16th March 2011, 03:10
  5. Replies: 0
    Last Post: 21st July 2010, 10:32

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.