Page 1 of 2 12 LastLast
Results 1 to 20 of 24

Thread: imageformats plugins

  1. #1
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default imageformats plugins

    Hi,

    I followed the Qt centre instructions and I copied everything from QT's "plugins/imageformats" into my "C:/my_qt_compiling_directory/imageformats" and recompiled my program but still my program cannot handle image files. Do I need to make some changes to the project file? Or maybe I'm missing somethig else. Thanks.

  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: imageformats plugins

    It doesn't matter where the imageformats are when you compile the application. It matters where they are when you run it. If you run it on a computer that has Qt installed, they should work fine regardless where you place the application binary. When you deploy on another machine they have to be where the FAQ states.

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

    ht1 (5th January 2008)

  4. #3
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: imageformats plugins

    Thanks Wysota,

    When I run my program on a machine that doesn't have Qt installed and I put the image plugins in the folder suggested in the FAQ, they still don't function. Is there a way to statically link these plugins to my exe file during compilation somehow?

  5. #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: imageformats plugins

    If you have their static versions compiled, then yes. But I suggest to take a look at why the plugins are not working for you. Verify it is really related to the plugins by loading a PNG image that doesn't use a plugin. Do it exactly the same way you do for other images. At best just replace a ".jpg" with ".png" in your application code and replace the JPEG image with a PNG one.

  6. The following user says thank you to wysota for this useful post:

    ht1 (5th January 2008)

  7. #5
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: imageformats plugins

    Thansk again, Wysota,

    I know that my program is OK because it works with BMP (and not with TIFF, GIF or JPG) images on the computer that does not have Qt4 installed and it works with all images on the computer that has Qt4 installed.

    How could I obtain/compile static versions of the imageformats dll files. Linking them to my exe seems like the best solution to me.

  8. #6
    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: imageformats plugins

    Quote Originally Posted by ht1 View Post
    Thansk again, Wysota,

    I know that my program is OK because it works with BMP (and not with TIFF, GIF or JPG) images on the computer that does not have Qt4 installed and it works with all images on the computer that has Qt4 installed.
    What does this small program return on either of the machines?

    Qt Code:
    1. #include <QtGui>
    2. #include <QtDebug>
    3.  
    4. int main(int argc, char **argv){
    5. QApplication app(argc, argv);
    6. foreach(const QByteArray &fmt, QImageReader::supportedImageFormats()){
    7. qDebug() << QString(fmt);
    8. }
    9. return 0;
    10. }
    To copy to clipboard, switch view to plain text mode 

    How could I obtain/compile static versions of the imageformats dll files. Linking them to my exe seems like the best solution to me.
    You need to reconfigure and rebuild Qt. configure -help will show you the proper options.

  9. The following user says thank you to wysota for this useful post:

    ht1 (5th January 2008)

  10. #7
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: imageformats plugins

    Hi Wysota.

    I ran your test program on the machine that has Qt4 but I did not detect anything happening at all. Is this program supposed to list the file extentions supported?

    In order to compile imageformats dll files I have to reconfigure Qt in on my computer??That sounds a bit complicated for my current knowledge but I'd like to try it. Are there any step by step instructions available?

  11. #8
    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: imageformats plugins

    Quote Originally Posted by ht1 View Post
    I ran your test program on the machine that has Qt4 but I did not detect anything happening at all.
    Add CONFIG+=console to the project file, rerun qmake and rebuild the project.

    Is this program supposed to list the file extentions supported?
    Yes.

    In order to compile imageformats dll files I have to reconfigure Qt in on my computer??
    Yes.

    That sounds a bit complicated for my current knowledge
    So use the shared versions. They are much less complicated and you still haven't verified they are the ones causing trouble. Do that first before trying more tedious options like the one below.

    Are there any step by step instructions available?
    configure -help then configure <your set of switches go here> and then mingw-make or whatever your make command is.

  12. The following user says thank you to wysota for this useful post:

    ht1 (5th January 2008)

  13. #9
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: imageformats plugins

    Thanks again, Wysota, I got your test program to work now.

    The computer that does not have Qt4 recognizes bmp, pbm, pgm, png, ppm, xbm, xpm as image files. The list is not getting longer when I put all the Qt image dll files in the "imageformats" folder.
    The computer that has Qt4 recognizes all 14 file formats as image files.
    So, what's your professional verdict? What do you think could be wrong? Many thanks!

  14. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: imageformats plugins

    Quote Originally Posted by ht1 View Post
    The list is not getting longer when I put all the Qt image dll files in the "imageformats" folder.
    Could you post the full paths to that folder and the executable? Is that application compiled in release mode?

  15. The following user says thank you to jacek for this useful post:

    ht1 (7th January 2008)

  16. #11
    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: imageformats plugins

    Quote Originally Posted by ht1 View Post
    So, what's your professional verdict?
    My professional verdict is that your image plugins are not loaded.

    What do you think could be wrong?
    You are probably mixing debug and release mode files, you have missing dependencies or your paths are incorrect. I suspect Jacek will want to suggest at least one of the three right after you answer his questions.

    Oh, and I'd like to add one more question to his few - Could you list the exact file names of Qt libraries you have deployed on the target machine?

  17. The following user says thank you to wysota for this useful post:

    ht1 (7th January 2008)

  18. #12
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: imageformats plugins

    Wysota and Jacek, your recommendations were very good and I was able to get my program to work. Thanks! Mixed up paths was the problem.

    I'd like to pursue trying to put everytihing (all the dll files) into one exe file. I understand that I have 2 options:
    1) reconfigure my mingw
    2) obtain static versions of these dll files

    I played with reconfiguring and did not get very far. I am not sure what the configuration options are that I need to use. Has anybody recently done this with mingw? I'd be very thankful for your help.
    The second question is about obtaining these static versions of the dll files. How?

  19. #13
    Join Date
    Jan 2008
    Posts
    1
    Thanked 1 Time in 1 Post

    Default Re: imageformats plugins

    I have this problem before and it can fixed below:

    1. Assuming your program is in c:\myapp
    2. Copy imageformats folder in your program folder: c:\myapp, and you can just keep those dlls you really need.
    3. Add library path right after the initiation of the qApplication

    Should be OK

  20. The following user says thank you to banzai.ed for this useful post:

    ht1 (8th January 2008)

  21. #14
    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: imageformats plugins

    Quote Originally Posted by ht1 View Post
    I played with reconfiguring and did not get very far. I am not sure what the configuration options are that I need to use. Has anybody recently done this with mingw?
    The essential switch is "-static".

    The second question is about obtaining these static versions of the dll files. How?
    They are not distributed anywhere.

  22. The following user says thank you to wysota for this useful post:

    ht1 (8th January 2008)

  23. #15
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: imageformats plugins

    Banzai.ed, thanks!

    I am a bit unclear how you do this:

    3. Add library path right after the initiation of the qApplication
    Do you just type in your main functions something like

    Qt Code:
    1. c:/myapp/imagefomats
    To copy to clipboard, switch view to plain text mode 

    This won't compile.

  24. #16
    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: imageformats plugins

    He was talking about QCoreApplication::addLibraryPath().
    J-P Nurmi

  25. The following user says thank you to jpn for this useful post:

    ht1 (8th January 2008)

  26. #17
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: imageformats plugins

    JPN, thanks for your clarification.
    So it looks like this is the way to add a library path?

    Qt Code:
    1. QString myPath;
    2. myPath = "c:/Qt/myapp/imageformats";
    3. application.addLibraryPath(myPath);
    To copy to clipboard, switch view to plain text mode 

    It looks like this achieves that my DLL's can be in any folder I want to put them but I still have to have separate DLL's to make my program run. I'd really like to figure out how to statically link DLL's to my executable using mingw.

  27. #18
    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: imageformats plugins

    You'd start with building static version of Qt and its plugins. See our wiki for more details: [WIKI]Building static applications[/WIKI]. Make sure you pay attention to configure output. It will inform you about plugins being built. Once you have succeed building a static Qt + plugins, you will have to import static plugins to your app: Static Plugins.
    J-P Nurmi

  28. The following user says thank you to jpn for this useful post:

    ht1 (8th January 2008)

  29. #19
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default compiler can't find plugins

    JPN, that was a very useful link, thanks.

    I got my Qt rebuilt and it now makes exe files that are idependent of mingw DLL's and that part is great.

    But when I try to use Qt plugins as explained in http://doc.trolltech.com/4.3/plugins-howto.html (I updated both main.cpp and myproject.pro as suggested in tutorial), the compiler gives me error message "can't find -lqjpg". This means it cannot find the static plugin. How do I make the compiler find it? Where is this file located? Do I need to put it in the same folder with my main.cpp when I compile? Is there more to compiling in the static mode than just typing "make" at my mingw prompt (this is all I did back when I used DLL's)?

  30. #20
    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: compiler can't find plugins

    Did you configure Qt to build static plugins? Do you have them after the built is complete?

  31. The following user says thank you to wysota for this useful post:

    ht1 (9th January 2008)

Similar Threads

  1. Qt Plugins Error
    By nathanpackard in forum Qt Programming
    Replies: 1
    Last Post: 17th August 2007, 23:19
  2. Nightmares with plugins
    By KShots in forum Qt Programming
    Replies: 6
    Last Post: 8th February 2007, 16:46
  3. Qt plugins - how to do a libtool-style autoload
    By KShots in forum Qt Programming
    Replies: 2
    Last Post: 7th February 2007, 12:40
  4. Arthur Plugins demos and designer
    By antonio.r.tome in forum Installation and Deployment
    Replies: 4
    Last Post: 21st March 2006, 14:01
  5. Plugins as small application
    By blackliteon in forum Qt Programming
    Replies: 4
    Last Post: 12th January 2006, 09:39

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.