QT 5.4, Unable to access Resource from code

前端 未结 2 1538
清酒与你
清酒与你 2021-01-28 07:58

I try to include style images of my app into a q-resource file. When I include the file directly in the code, it work, but when i try to use QResource, it fail (do not load the

相关标签:
2条回答
  • 2021-01-28 08:28

    QResource::registerResource("darkstyle.qrc") registers the resource description. If you want to use resources dynamically like this you need to register the compiled resources themselves. Run rcc -binary darkstyle.qrc -o darkstyle.rcc and use QResource::registerResource("darkstyle.rcc")

    Alternatively, compile the resources into your binary directly. Do do so, use RESOURCES += darkstyle.qrc in your .qrc, and leave out the QResource::registerResource.

    0 讨论(0)
  • 2021-01-28 08:35

    The problem is related to an incompatibility of the given version of QT with MSVS2013. The problem is solved by downloading another version of QT or visual studio.

    0 讨论(0)
提交回复
热议问题