[QBS] Adding resources to .UI files in Qt Creator?

Hristo Hristov registrirayme at live.com
Mon Mar 9 20:02:52 CET 2015


Hello,
I will try to describe a workflow with Qt Creator:
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.
I would like to know if I am doing something wrong or this is not yet supported in the qbs plugin? 
Here is a screenshot: http://i59.tinypic.com/30scz60.png
I hope I explained it better this time. Thank you!

Also if it matters I use sub-projects construct:
Project {    references: [        "ImagePuzzles/ImagePuzzles.qbs",        "Puzzles/Puzzle001/Puzzle001.qbs"    ]}
Regards
       HGH



> Date: Mon, 9 Mar 2015 16:50:09 +0100
> From: christian.kandeler at theqtcompany.com
> To: qbs at qt-project.org
> Subject: Re: [QBS] Adding resources to .UI files in Qt Creator?
> 
> On 03/09/2015 04:37 PM, Hristo Hristov wrote:
> > I have added a .qrc file with icons to my project. Now I want to add icons to my actions defined in the .UI files but the resource editor does not display my resources (unlike if I use qmake .pro file).Is this feature supported yet and how do I add the resources to my forms?
> 
> Could you explain in more detail what you are trying to do and how? I'm 
> afraid I haven't fully grasped it. In particular, what are the steps you 
> took and how does the result differ from what yaou expected? Plus, which 
> qmake construct(s) did you use whose qbs counterpart(s) you are looking for?
> 
> 
> Christian
> 
> _______________________________________________
> QBS mailing list
> QBS at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qbs
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20150309/823dc756/attachment.html>


More information about the Qbs mailing list