Results 1 to 6 of 6

Thread: QPixmap working on one PC, not another

  1. #1
    Join Date
    Oct 2009
    Location
    South Africa
    Posts
    94
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QPixmap working on one PC, not another

    Hi all
    I am using QPixmap to load a blob/image from a database.
    On one PC it works fine, however on a second PC not.
    I did some troubleshooting, and it seems that on both PC's it is getting the data correctly from the database, however, on the QPixmap loadFromData function, it is returning false from the second PC.
    The troubleshooting I did was to see if on the second PC it was failing on the query, however I am able to get the same ba.size() (the QbyteArray) from both of them.
    I did initially try setting the header to jpg, but again without the second one showing an image (on a QLabel), so I just left it as default.
    Can someone offer some clue why it would work differently on 2 PC's? Obviously the exact same executable, however on the one PC where it is working I am running Windows 8, on the 2nd I am running Windows Embedded (7).

    This is the code I am using...

    Qt Code:
    1. QByteArray ba = query.value(0).toByteArray();
    2. outPixmap = QPixmap();
    3. outPixmap.loadFromData(ba);
    4. return outPixmap;
    To copy to clipboard, switch view to plain text mode 

    Unfortunately I am leaving work now, but I will be back in the morning.
    Thank you.

  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: QPixmap working on one PC, not another

    Have you already checked if two versions have the same supported image formats?

    Cheers,
    _

  3. #3
    Join Date
    Oct 2009
    Location
    South Africa
    Posts
    94
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPixmap working on one PC, not another

    Thank you for the reply.
    The image format is jpg, whether I include this in the header or not has the same outcome, i.e. showing on one PC, not the 2nd.
    Also, with both operating systems being Windows, I would think this is a standard format that is supported.
    If I save the data directly to a file, both PC's can open it through Windows Explorer.
    Is there possibly a separate library/dll that I should be including to tell Qt itself to recognise it as a jpg?

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPixmap working on one PC, not another

    JPG is supported by Qt plugin - look at plugins/imageformats Qt directory.

  5. #5
    Join Date
    Oct 2009
    Location
    South Africa
    Posts
    94
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPixmap working on one PC, not another

    Thank you, I found someone else with the same issue on
    http://www.qtcentre.org/threads/2833...ter-deployment

    I had to create a folder called imageformats under my executable folder, and copy the dll called qjpeg.dll to it and then it worked.

  6. #6
    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: QPixmap working on one PC, not another

    Quote Originally Posted by ShamusVW View Post
    Is there possibly a separate library/dll that I should be including to tell Qt itself to recognise it as a jpg?
    Yes, that's why I asked if you had already checked.
    As in looked at the list returned by http://doc.qt.io/qt-5/qimagereader.h...edImageFormats

    Cheers.
    _

Similar Threads

  1. Replies: 7
    Last Post: 24th September 2012, 07:17
  2. Replies: 1
    Last Post: 23rd February 2012, 11:13
  3. Replies: 4
    Last Post: 28th August 2008, 13:13
  4. Replies: 1
    Last Post: 21st August 2008, 07:44
  5. Replies: 5
    Last Post: 9th April 2007, 14:26

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.