user1767754
user1767754

Reputation: 25094

Qt QRC File path to image file not working

I was developing on mac and i had no problems with path to QRC, after switching to windows, links to image stopped working. But however qss files can be referenced and are working!

1) I've created a new Ressource File from Scratch

2) I've Rebuild the Project

3) I've used the path delivered by qt:

enter image description here

4) Full Path is working:

QVariant(QIcon(QPixmap("V:/070_RnD/AssetBrowser_02/images/checkbox.png")));

5) QRC-Path isn't

QVariant(QIcon(QPixmap(":/myresources/images/checkbox.png")));

What can i test more? Ass i said, when i copy the ressource path from default.qss it is recognized, but images not.

QRC-Code:

<RCC>
    <qresource prefix="/myresources">
        <file>images/scrollHandle.png</file>
        <file>images/upArrow.png</file>
        <file>images/downArrow.png</file>
        <file>images/folder-icon.png</file>
        <file>images/branch-closed.png</file>
        <file>images/branch-open.png</file>
        <file>images/checkbox.png</file>
        <file>qss/default.qss</file>
    </qresource>
</RCC>

Upvotes: 1

Views: 4620

Answers (1)

Lahiru Chandima
Lahiru Chandima

Reputation: 24068

Resource paths you have used looks compatible with your qrc file. So may be Qt resource compiler may have missed your qrc file.

Check whether your qrc file is included in the .pro file like below.

RESOURCES += \
    Style.qrc

If it is correctly included in the .pro file, then try Build->Run QMake and then Build->Rebuild project. This will re-generate the makefile and rebuild the project.

Upvotes: 3

Related Questions