Results 1 to 9 of 9

Thread: QtCreator, QPixmap & jpeg support

  1. #1
    Join Date
    Jun 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default QtCreator, QPixmap & jpeg support

    I'm using Windows and trying to show jpeg image in QLabel, but it doesn't want to load it with QPixmap. I found some older threads which say I have to load jpeg plugin. I tried inserting "QTPLUGIN += qjpeg" into .pro file, adding "#include <QtPlugin>" with "plugin import" but no luck. After I add any of those, I get "collect ld" error from compiler. I thought it could be because Qt wasn't configured with "-qt-libjpeg", and after 2 hours of reconfigurin and compiling it wouldn't work anyway. Any help?

  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: QtCreator, QPixmap & jpeg support

    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.


  3. #3
    Join Date
    Jun 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QtCreator, QPixmap & jpeg support

    I can't compile with plugin support and without it fails to load jpeg with qpixmap.
    Last edited by NinoUzi; 26th June 2009 at 23:27.

  4. #4
    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: QtCreator, QPixmap & jpeg support

    Quote Originally Posted by NinoUzi View Post
    I can't compile with plugin support
    Why?

    and without it fails to load jpeg with qpixmap.
    You need the plugin either in its static or dynamic version.
    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.


  5. #5
    Join Date
    Jun 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QtCreator, QPixmap & jpeg support

    Qt Code:
    1. #include <QtCore/QtPlugin>
    2.  
    3. Q_IMPORT_PLUGIN(qjpeg);
    To copy to clipboard, switch view to plain text mode 

    ->
    Qt Code:
    1. release/main.o(.text+0x189):main.cpp: undefined reference to `qt_plugin_instance_qjpeg()'
    2. collect2: ld returned 1 exit status
    To copy to clipboard, switch view to plain text mode 

    If I add QTPLUGIN += qjpeg into .pro file, I get this error:

    Qt Code:
    1. F:\Qt\2009.02\mingw\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lqjpeg
    2. collect2: ld returned 1 exit status
    To copy to clipboard, switch view to plain text mode 

    I also tried to remove all that code and put qjpeg4.dll into my executable folder (release), but still nothing loads
    Last edited by NinoUzi; 27th June 2009 at 13:10.

  6. #6
    Join Date
    Jun 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QtCreator, QPixmap & jpeg support

    I got it to work finally, I searched these forums a bit and found I have to put qjpeg4.dll into "imageformats" folder and not directly where my exe is.

  7. #7
    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: QtCreator, QPixmap & jpeg support

    Quote Originally Posted by NinoUzi View Post
    I got it to work finally, I searched these forums a bit and found I have to put qjpeg4.dll into "imageformats" folder and not directly where my exe is.
    It would be easier if you just read the text behind the link I gave you.
    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.


  8. #8
    Join Date
    Jun 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QtCreator, QPixmap & jpeg support

    "Why no images are displayed when I deploy my application on another machine that doesn't have Qt installed even though they are displayed on my computer?"

    That wasn't my problem so I didn't think that fix would work. I didn't think it would require imageformats/ in Release/Debug path of project.

  9. #9
    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: QtCreator, QPixmap & jpeg support

    Quote Originally Posted by NinoUzi View Post
    That wasn't my problem so I didn't think that fix would work. I didn't think it would require imageformats/ in Release/Debug path of project.
    Sure it was :-)

    And copying the plugins is not necessary, Qt looks for them in its standard paths therefore you had a non-standard installation of Qt (apart from the standard one you probably also had as I assume the plugins did reside in the imageformats subdirectory of the plugins directory of the installation).
    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. Installation Problem
    By QbelcorT in forum Installation and Deployment
    Replies: 4
    Last Post: 22nd April 2010, 09:04
  2. Qt 4.4.3 commercial on Kubuntu 8.10
    By Micawber in forum Installation and Deployment
    Replies: 5
    Last Post: 17th February 2010, 01:02
  3. Qt-4.4.0 installation error in linux
    By babu198649 in forum Installation and Deployment
    Replies: 4
    Last Post: 27th May 2008, 14:35
  4. Qt static library with jpeg support
    By vishal.chauhan in forum Installation and Deployment
    Replies: 2
    Last Post: 11th May 2007, 06:53
  5. Strange Problem with JPEG Support on win XP
    By caligula in forum Installation and Deployment
    Replies: 3
    Last Post: 18th September 2006, 10:36

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.