[QBS] Adding resources to .UI files in Qt Creator?
Christian Kandeler
christian.kandeler at theqtcompany.com
Tue Mar 10 10:29:44 CET 2015
On 03/09/2015 08:02 PM, Hristo Hristov wrote:
> 1. Use the Project wizard to create a new Qt Widgets Application project (qmake).2. Use the Project wizard to add a new Qt Resource file to the project.This step produces the following qmake construct:
> RESOURCES += \
> resources.qrc3. Add some images to the resource.qrs (these will be used as icons)4. Open the mainwindow.ui file (the default that was created) in Qt Creator Design mode.5. I use the "Type Here" feature on the QMenuBar on the Design surface/canvas (whatever it is called) to add a new QMenu item and then to add a QAction.Now if I select the QAction item and go to the property editor. I can select the icon property and click on the "...V" button to open a "Select Resource" dialog. Here I can select the desired icon from the resource and set it to the QAction item.
> This is basically what I want to do with my qbs Qt Widgets project. I added a resource file like that: 1. Right-click on the project tree, select "Add New" then add a Qt Resource file to the project.2. Add images to the resource file.I actually moved the resource file to a Group item in the qbs project: Group { name: "Resources" files: [ "res/imagepuzzles.qrc", ] }Now I want to do the same I've described in Step 5 above (to edit my MainWindow.ui in Design Mode and add resources from a resource file). Unfortunately "Select Resource" dialog is empty and does not display the Resource file and I cannot set the images from the resources this way.
Thanks, I understand now. The behavior you are seeing is due to a
shortcoming in the qbs API. I have created a task here:
https://bugreports.qt.io/browse/QBS-762
This is easy to implement, but too intrusive to put it into 1.4.0, so it
will take a bit before the fix makes it into Qt Creator.
Thanks for the report.
Christian
More information about the Qbs
mailing list