Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

How to use Resource Editor with Qt Creator

From 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
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....


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


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


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




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


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


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.


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


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




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.


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