[SOLVED] Application not displaying .ico file format



  • When a QToolButton is clicked on my application, I give the user the option to add a custom icon (external .ico file located on the file system anywhere). The file that is selected is then placed as the icon on the QToolButton. This works perfect on my PC running windows with the QtSDK installed (windows 7), but with my application in release mode on another PC linked to the .dlls dynamically located in the application folder (no QtSDK) the .ico files do not show on my QToolButton when the button is clicked, and an external .ico is selected. Everything else works perfect except for the icons not being displayed.

    Unfortunately I cannot put them in a resource file since the user could select ANY icon file on the file system or anywhere for that matter.

    I have read multiple instances of this happening to people and there has been no definite solution on any threads, so I have tried these things so far:
    Adding the plugins to my executable folder that came with the QtSDK for my build version
    Using QApplication::addLibraryPath() to add the plugins path in my main.cpp

    I have run out of thoughts...I know its got to be something simple with linking to plugins or something of that nature...Does anyone have an idea of what could be going wrong?



  • bq. Unfortunately I cannot put them in a resource file since the user could select ANY icon file on the file system or anywhere for that matter.

    Do you mean that the .ico will be shown properly once you put them to resources? or this is just you guess?

    bq. Adding the plugins to my executable folder that came with the QtSDK for my build version
    Using QApplication::addLibraryPath() to add the plugins path in my main.cpp

    More details need. where the plugin your put to? where the plugin you copied from?

    • yourApplication.exe
    • QtCore4.dll
    • QtGui4.dll
    • ...
    • imageformats/qico4.dll
    • ...


  • I had it pretty much the same as shown above but this:

    myapp.exe
    QtCore4.dll
    QtGui4.dll
    qico4.dll

    I tried:
    qico4.dll
    imageformats/qico4.dll
    plugins/imageformats/qico.dll

    but it made sense to me the first way since thats how it links up to the other executables



  • [quote author="dvez43" date="1337395426"]
    I tried:
    qico4.dll
    imageformats/qico4.dll
    plugins/imageformats/qico.dll

    but it made sense to me the first way since thats how it links up to the other executables[/quote]

    No, the first is always WRONG unless you have changed source code of Qt itself.

    The third will work if you have added the "plugins" to your application's libraryPath. You can directly call addLibraryPath(). or you can use qt.conf file, or use environment variable, or even changing the strings in QtCore4.dll itself(yes, using a hexeditor or something similar).

    The second way it easily to use, nothing special need to to.


    By the way, make sure that qico4.dll copied from right place, as you may have more that one qico4.dll exist in your SDK.



  • I am using the msvc2008 compiler so i got it from desktop/4.8.1/msvc2008/plugins...ect act

    Thank you for your help, I will give it a shot in the morning. I have run into this before but got around it be converting the .ico to png's...but in this case, I cannot.

    Thanks again.



  • I went back and diddled around with it a little bit and found that the 2nd way worked! thank you very much for the help!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.