Results 1 to 4 of 4

Thread: Qt4 does not load JPG's.

  1. #1
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    64
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qt4 does not load JPG's.

    I configured Qt 4.3.1 for X11 on OpenSUSE 10.2 as follows:

    ./configure -static -release -no-qt3support -qt-zlib -qt-gif -qt-libpng -qt-libmng -qt-libjpeg -qt-libtiff -nomake demos -nomake examples -nomake tools

    make

    su
    make install

    Everything works nice, except that I can not load JPG pictures:

    mypixmap->load(":/images/picture.jpg");

    It returns FALSE.

    when I try this with a PNG picture (same resolution) it works.

    What is missing to load JPG's? I configured with -qt-libjpeg.

  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: Qt4 does not load JPG's.

    You have to import a static plugin into your application using Q_IMPORT_PLUGIN(qjpeg) macro. See docs for details.

  3. #3
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    64
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt4 does not load JPG's.

    Quote Originally Posted by wysota View Post
    You have to import a static plugin into your application using Q_IMPORT_PLUGIN(qjpeg) macro. See docs for details.
    Isn't it possible to link static to the jpeg lib?

    Why this difference between png and jpg? I mean, why does it load png files
    without a plugin?

  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: Qt4 does not load JPG's.

    Linking statically to the jpeg library (or rather the Qt plugin that links to libjpeg) is not enough. The application needs to be informed about the plugin - that's what the Q_IMPORT_PLUGIN macro is for.

    PNG file support is embedded directly into Qt, without any plugins - that's why you can always load PNG or XPM images. This is not the case with JPEG or GIF. Reasons? As for GIF, surely the patent thing... As for JPEG? I don't know... ask Trolltech.

Similar Threads

  1. How to load icons from resource file
    By joseph in forum Qt Programming
    Replies: 7
    Last Post: 25th June 2012, 07:00
  2. Replies: 2
    Last Post: 13th September 2006, 09:11
  3. Replies: 4
    Last Post: 7th March 2006, 08:52
  4. Replies: 4
    Last Post: 1st March 2006, 23:11
  5. Why I can't load .framework libraries on Mac X?
    By gtthang in forum Qt Programming
    Replies: 0
    Last Post: 17th February 2006, 11:32

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.