[SOLVED] Icons are not visible when i run the application.



  • I have created the Qt resource file, and added some icons (jpg,png) to it and saved it
    In the designer, i have added a pushbutton, and changed it's icon to one from the resources files

    But when i run the application no icons appear...
    edit: Qt 5.02 on windows 8



  • For jpg, you need the appropriate imageformat plugin to be present. Otherwise: check your paths. Are you sure that in your application the images come from the resources, and not from the file system?



  • [quote author="Andre" date="1371126946"]For jpg, you need the appropriate imageformat plugin to be present. Otherwise: check your paths. Are you sure that in your application the images come from the resources, and not from the file system?[/quote]

    i got the same problem on jpg and png.

    The pictures are located at
    Project folder/Pictures/Subfolder
    I have added a new resource file via right click on project->add new
    After that i created the pushbutton and changed the icon

    In other words i can see the icon when i am on the designer but when i execute it i don't



  • What path are you using to load the icons?



  • [quote author="Andre" date="1371127662"]What path are you using to load the icons?[/quote]

    That's what i am trying to tell you this whole time :D
    I am using the designer to set the icons

    !http://i.imgur.com/nNmny23.png(1)!



  • The solution is find and put the folder "imageformats" in the same folder of the app .

    or in the system32 folder, and add these lines in main.cpp.
    @

    ifdef Q_OS_WIN32

    QString env = getenv ("SYSTEMROOT");
    #endif

    ifdef Q_OS_WIN32

    QCoreApplication :: addLibraryPath (env + "\ system32");

    endif@



  • That should not be needed for .png files. PNG support is build in, and does not rely on plugins.



  • Must have something to do with Windows.
    I am using icons this way 2 years on Qt for Ubuntu...



  • Try cleaning the project and running qmake again.Had the same problem a few days ago and it seems that changes to the ressource files were being ignored.



  • [quote author="musimbate" date="1371191557"]Try cleaning the project and running qmake again.Had the same problem a few days ago and it seems that changes to the ressource files were being ignored.
    [/quote]

    Windows sucks balls!

    Thank you it worked ;)



  • In this case more likely it is qmake and the makefiles it generates that screw up...



  • Glad it worked for you Leon.



  • Worked for me too. Has anyone filed a bug report yet?



  • [quote author="joshua-anderson" date="1379464605"]Worked for me too. Has anyone filed a bug report yet?[/quote]
    there is no similar bug on qt bugreports

    so here ya go!
    https://bugreports.qt-project.org/browse/QTBUG-33541


Log in to reply
 

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