Results 1 to 4 of 4

Thread: Export GraphicsView contents as JPG

  1. #1

    Unhappy Export GraphicsView contents as JPG

    Hi, the following code doesn't seem to work, it should take a 'screenshot' of the contents of the whole of the QGraphicsView. For some reason it doesn't. The contents of the saved file is blank (open in notepad, no data at all).
    If I change JPG to BMP it works, but the image is inverted. (black white white black)
    Anybody know what I'm doing wrong?
    Last edited by Terabyte; 5th January 2009 at 19:43.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Export GraphicsView contents as JPG

    What does:
    Qt Code:
    1. qDebug() << QImageWriter::supportedImageFormats();
    To copy to clipboard, switch view to plain text mode 
    output?
    J-P Nurmi

  3. #3
    Join Date
    Jun 2008
    Location
    Boulder, Colorado, USA
    Posts
    70
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Export GraphicsView contents as JPG

    I had, I think, a related problem with JPG files. (As suggested also by jpn's response) ...

    QImageWriter supportedImageFormats only sometimes includes JPEG. Why?
    http://www.qtcentre.org/forum/f-inst...post87899.html

    In particular, the problem is addressed within this FAQ:
    http://www.qtcentre.org/forum/faq.ph...missing_images

    You probably didn't deploy image plugins with your application. You need to copy the contents of plugins/imageformats directory of your Qt installation to the imageformats subdirectory of the directory where you deployed the application binary.

    For instance if you deployed the application to C:\Program Files\MyApp, you need to copy the plugins to C:\Program Files\MyApp\imageformats.

    Imageformat plugins are libraries called "qjpeg", "qsvg", "qtiff", etc.

  4. #4

    Default Re: Export GraphicsView contents as JPG

    Thanks. that worked a charm
    Last edited by Terabyte; 5th January 2009 at 19:42.

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.