Results 1 to 5 of 5

Thread: QPainter.drawImage() not working with resource image file

  1. #1
    Join Date
    Aug 2009
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    2

    Default QPainter.drawImage() not working with resource image file

    It works fine in the development machine, but in other computers the image doesn't show up. I have also tried using drawPixmap() but the behaviour is the same. Shouldn't the resource be embedded in the executable?

    I"ve tried debug and release compilations but both presents this "problem". Ideas?

  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: QPainter.drawImage() not working with resource image file

    Let me guess: you are using jpg files. You have to deploy the right jpg plugin with our application. See the docs on how to deploy an application.

  3. The following user says thank you to Lykurg for this useful post:

    thiagoalencar22 (22nd April 2010)

  4. #3
    Join Date
    Aug 2009
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    2

    Default Re: QPainter.drawImage() not working with resource image file

    Thanks Lykurg for pointing me to the right direction!

    Actually I had tried different file formats before but the problem persisted, but I never realized I would need to change anything to use a functionality available from Qt's libraries itself.

    What I would always do is simply copy the DLLs needed by the executable and it always worked fine, for example, simply copying the "libmySQL.dll and QtSQl4.dll" to the same folder as the executable is enough to make the sql calls work (I never used plugins before). Why is it different with the drawImage() function?

    We have more than one Qt executables here so I don't think compiling as stand-alone(static linking) would be a good choice. Do you have any specific recommendations?

    Greetings from Brazil!
    Thiago

  5. #4
    Join Date
    Aug 2009
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    2

    Default Re: QPainter.drawImage() not working with resource image file

    Got it working now. I didn't change anything - simply copied the respective plugin dll which was missing.
    Thank you!

  6. #5
    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: QPainter.drawImage() not working with resource image file

    Well, the jpeg plugin works exactly like the sql one. Just copy the jpeg dll (sorry don't know the right file name since I am now on my linux computer) to your executable (or in the subdirectory imageformats). It's a little bit confusing but a "Qt plugin" is an ordinary library. So you don't have to compile statically.

    And the problem is, that the sdk dll's have build in png support but no jpeg. If you don't want do deliver also the jpeg plugin you can also rebuild Qt and activate build-in jpeg support (-qt-libjpeg).

    EDIT: Ah, you get it to work! Then I was too late...

Similar Threads

  1. Resource file in Qt4.4.0
    By jml in forum Qt Tools
    Replies: 0
    Last Post: 6th May 2008, 18:01
  2. QTextDocument Image resource problem
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 16th August 2007, 15:28
  3. Resource file in a lib
    By Rodrigo in forum Qt Programming
    Replies: 4
    Last Post: 25th June 2007, 15:22

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.