Schütze
Schütze

Reputation: 1084

Button icons are not showing on Run

I am trying to display icons (all .png files) on my QPushButtons however for some strange reason, some are showing and some are not, which is why I cannot understand the problem.

Here is my .qrc file under my project:

<RCC>
    <qresource prefix="/">
        <file>icons/auto.png</file>
        <file>icons/connect.png</file>
        <file>icons/disconnect.png</file>
        <file>icons/home.png</file>
        <file>icons/manual.png</file>
        <file>icons/measures.png</file>
        <file>icons/move_to.png</file>
        <file>icons/reset.png</file>
        <file>icons/spindle_off.png</file>
        <file>icons/spindle_on.png</file>
    </qresource>
</RCC>

which I created by using the Qt Creator's menu. So I have this under my .pro file as well:

RESOURCES  = myresource.qrc \

All the icon paths are confirmed and they load on the GUI design screen. However, when I run, I get only some of them showing, the rest are missing. They all have the same size, same extension, etc. I really cannot get what is going on.

enter image description here

P.S: I did run qmake after adding my resources.

EDIT: I noticed that my label (which has an image inside) also does not appear on runtime. So it is not only the buttons.

Upvotes: 4

Views: 2660

Answers (1)

Sch&#252;tze
Sch&#252;tze

Reputation: 1084

I solved the problem by simply resetting all the button icons to default (no icons) and then reassigning the icons. I don't know what the problem was, but this solved my problem.

Upvotes: 1

Related Questions