Question

I created a .qrc file in Qt 5.0.1:

<RCC>
<qresource>
    <file>105.ico</file>
</qresource>
</RCC>

and I edited my .pro file:

RESOURCES += \
Icons.qrc

when I use the code below in my class constructor icon doesn't appear

 this->setWindowIcon(QIcon(":105.ico"));

but when I give a local file address instead of ":105.ico" icon shows up. what is the problem?

Était-ce utile?

La solution

It should be:

this->setWindowIcon(QIcon(":/105.ico"));

(Note the slash)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top