×
Namespaces

Variants
Actions
Revision as of 07:22, 23 March 2010 by james1980 (Talk | contribs)

How to use Resource Editor with Qt Creator

From Nokia Developer Wiki
Jump to: navigation, search


Overview

This article will explain, how the developer can use Resource Editor in the Qt Creator for setting icon and other resources for your application.

Prerequisite

  • Here it is assume that a user had a properly set the developement environment for Qt application development. And also Qt sdk for windows is also installed.

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 are 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

831 page views in the last 30 days.
×