Important: Please read the Qt Code of Conduct -

ToolButton not showing icon

  • I'm using QtCreator v2.6.2 on a Kubuntu system with the final target being a BeagleBone Black with Qt 4.8 installed.

    I've been trying out a test program to get the feel of Qt and I put a Tool Button in my top widget and then set the Normal, Active Off, & Active On icons to gif files. The Designer shows the Icons, but when I compile and run the program, either for the desktop or for the BBB the icons are not shown.

    I'm probably missing something obvious, anybody have any ideas what I might have missed?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    How are you giving the path to your gif files ? Are you embedding them in a qrc file ?

  • Hi and thanks for the reply,

    I just entered the path in the ToolButton properties in the designer. The path show when I hover over the browse button is the complete path from the root.

    I haven't figured out yet how to create a resource file containing the gifs I'll be using.

  • My fault, I was not thinking correctly. I transferred the gifs over to the BBB in a directory with the same relative path as in the source code and all is now working correctly.

    I was making the assumption that the images would be embedded into the object code and that is not the case. Not really a problem in the end as long as I understand.

    Side question, is there some documentation that describe how to create a resource file containing gifs, jpgs, &/or pngs?

    Thanks for trying to help.

  • Lifetime Qt Champion

    The "The Qt Resource System" chapter from the documentation is what you are looking for. Qt Creator also provides an easy way to create a resource and add files to it.

Log in to reply