<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hello,<div><br></div><div>I will try to describe a workflow with Qt Creator:</div><div><br></div><div>1. Use the Project wizard to create a new Qt Widgets Application project (qmake).</div><div>2. Use the Project wizard to add a new Qt Resource file to the project.</div><div>This step produces the following qmake construct:<br><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#ff8bff;">RESOURCES</span><span style=" color:#646482;"> </span>+=<span style=" color:#646482;"> </span>\</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#646482;">    </span>resources.qrc</pre><pre style="margin-top: 0px; margin-bottom: 0px;">3. Add some images to the resource.qrs (these will be used as icons)</pre><pre style="margin-top: 0px; margin-bottom: 0px;">4. Open the mainwindow.ui file (the default that was created) in Qt Creator Design mode.</pre><pre style="margin-top: 0px; margin-bottom: 0px;">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.</pre><pre style="margin-top: 0px; margin-bottom: 0px;">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.</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre><pre style="margin-top: 0px; margin-bottom: 0px;">This is basically what I want to do with my qbs Qt Widgets project. I added a resource file like that: </pre><pre style="margin-top: 0px; margin-bottom: 0px;">1. Right-click on the project tree, select "Add New" then add a Qt Resource file to the project.</pre><pre style="margin-top: 0px; margin-bottom: 0px;">2. Add images to the resource file.</pre><pre style="margin-top: 0px; margin-bottom: 0px;">I actually moved the resource file to a Group item in the qbs project:</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#646482;">    </span>Group<span style=" color:#646482;"> </span>{</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#646482;">        </span><span style=" color:#ff5555;">name</span>:<span style=" color:#646482;"> </span><span style=" color:#ffcd8b; background-color:#404040;">"Resources"</span></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#646482;">        </span><span style=" color:#ff5555;">files</span>:<span style=" color:#646482;"> </span>[</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#646482;">            </span><span style=" color:#ffcd8b; background-color:#404040;">"res/imagepuzzles.qrc"</span>,</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#646482;">        </span>]</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#646482;">    </span>}</pre><pre style="margin-top: 0px; margin-bottom: 0px;">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.</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre><pre style="margin-top: 0px; margin-bottom: 0px;">I would like to know if I am doing something wrong or this is not yet supported in the qbs plugin? </pre><pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre><pre style="margin-top: 0px; margin-bottom: 0px;">Here is a screenshot: <a href="http://i59.tinypic.com/30scz60.png" target="_blank" style="font-family: Calibri, sans-serif; font-size: 12pt;">http://i59.tinypic.com/30scz60.png</a></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre><pre style="margin-top: 0px; margin-bottom: 0px;">I hope I explained it better this time. Thank you!</pre></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre><pre style="margin-top: 0px; margin-bottom: 0px;">Also if it matters I use sub-projects construct:
<pre style="margin-top: 0px; margin-bottom: 0px;">Project<span style=" color:#646482;"> </span>{</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#646482;">    </span><span style=" color:#ff5555;">references</span>:<span style=" color:#646482;"> </span>[</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#646482;">        </span><span style=" color:#ffcd8b; background-color:#404040;">"ImagePuzzles/ImagePuzzles.qbs"</span>,</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#646482;">        </span><span style=" color:#ffcd8b; background-color:#404040;">"Puzzles/Puzzle001/Puzzle001.qbs"</span></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#646482;">    </span>]</pre><pre style="margin-top: 0px; margin-bottom: 0px;">}</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>Regards</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre><pre style="margin-top: 0px; margin-bottom: 0px;">       HGH
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
</pre><br><div>> Date: Mon, 9 Mar 2015 16:50:09 +0100<br>> From: christian.kandeler@theqtcompany.com<br>> To: qbs@qt-project.org<br>> Subject: Re: [QBS] Adding resources to .UI files in Qt Creator?<br>> <br>> On 03/09/2015 04:37 PM, Hristo Hristov wrote:<br>> > 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?<br>> <br>> Could you explain in more detail what you are trying to do and how? I'm <br>> afraid I haven't fully grasped it. In particular, what are the steps you <br>> took and how does the result differ from what yaou expected? Plus, which <br>> qmake construct(s) did you use whose qbs counterpart(s) you are looking for?<br>> <br>> <br>> Christian<br>> <br>> _______________________________________________<br>> QBS mailing list<br>> QBS@qt-project.org<br>> http://lists.qt-project.org/mailman/listinfo/qbs<br></div></div>                                      </div></body>
</html>