×
Namespaces

Variants
Actions
Revision as of 06:54, 9 September 2011 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How to use Resource Editor with Qt Creator

From Nokia Developer Wiki
Jump to: navigation, search

This article demonstrates how to use Qt Creator's Resource Editor to set the icon and other resources for your application. The Resource file is an XML file that lists the files to embed in the executable.

Article Metadata
Tested with
SDK: Probably Qt SDK 1.0
Article
Keywords: resources
Created: james1980 (23 Mar 2010)
Last edited: hamishwillee (09 Sep 2011)

How to use Resource Editor

The Qt resource system is a platform-independent mechanism for storing binary files in the application's executable. This is useful if your application always needs a certain set of files (icons, translation files, etc.) and you don't want to run the risk of losing the files.

The resource used in a application are specified in a .qrc file which stores all necessary information regarding the resources used.

Following pictures shows the steps to use the resource editor.

Step-1: Right click on your project and select the Add New....

ResEdit1.jpg

Step-2: New dialog will appear and select Qt Resource File from it.

ResEdit2.jpg

Step-3: Give the name of your file. By default the file is added to your project.

ResEdit3.jpg

Step-4: Click on the finish and the .qrc file is shown into your project as shown below.

ResEdit4.jpg

Step-5:

ResEdit5.jpg

Step-6: Double click on your .qrc file and it will open the file in a resource editor. Click on the Add prefix.

ResEdit6.jpg

Step-7: After adding the prefix add the file to it.

ResEdit7.jpg

Step-8: Well now you can use the resource added to your file in your project. Here is the example of adding icon to the action and placin it to the toolbar.

ResEdit8.jpg

Step-9: Open the Action editor and add a new action. a dialog shown below will appear.

ResEdit9.jpg

Step-10: For assigning the icon select the add resource and select your resource file.

ResEdit10.jpg

Step-11

ResEdit11.jpg

Step-12: Now you can add your action to your toolbar and the icon will be displayed in the toolbar. You can also display the text under the icon by setting the property of the toolbar.

ResEdit12.jpg

This page was last modified on 9 September 2011, at 06:54.
877 page views in the last 30 days.