How to use Resource Editor with Qt Creator
(Created page with 'Category:Qt for Symbian =Overview= This article will explain, how the developer can use Resource Editor in the Qt Creator for setting icon and other resources for your appl…') |
hamishwillee
(Talk | contribs) m (Hamishwillee - Add ArticleNeedsUpdate template. Remove pre-requisites (can be assumed)) |
||
| (10 intermediate revisions by 5 users not shown) | |||
| Line 1: | Line 1: | ||
| − | [[Category:Qt | + | [[Category:Qt Creator]] |
| + | {{Abstract|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. | ||
| − | = | + | {{ArticleMetaData |
| + | |sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] --> | ||
| + | |installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) --> | ||
| + | |devices= <!-- Devices tested against - e.g. ''devices=N95, N8'') --> | ||
| + | |sdk=Probably Qt SDK 1.0 | ||
| + | |platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later --> | ||
| + | |devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) --> | ||
| + | |signing=<!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer --> | ||
| + | |capabilities=<!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. --> | ||
| + | |keywords=resources | ||
| + | |creationdate=23 March 2010 | ||
| + | |author=[[User:james1980]] | ||
| + | |reviewer=<!-- Following technical re-review of article: [[User:username]] --> | ||
| + | |timestamp=<!-- Following technical re-review of article: YYYYMMDD --> | ||
| + | }} | ||
| − | + | ==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. | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | Following pictures | + | |
| − | Step-1: | + | Step-1: Right click on your project and select the Add New.... |
| − | Right click on your project and select the Add New.... | + | |
[[File:resEdit1.jpg]] | [[File:resEdit1.jpg]] | ||
| − | Step-2 | + | Step-2: New dialog will appear and select Qt Resource File from it. |
| − | New dialog will appear and select Qt Resource File from it. | + | |
[[File:resEdit2.jpg]] | [[File:resEdit2.jpg]] | ||
| − | Step-3 | + | Step-3: Give the name of your file. By default the file is added to your project. |
| − | Give the name of your file. By default the file is added to your project. | + | |
[[File:resEdit3.jpg]] | [[File:resEdit3.jpg]] | ||
| − | Step-4 | + | Step-4: Click on the finish and the .qrc file is shown into your project as shown below. |
| − | Click on the finish and the .qrc file is shown into your project as shown below. | + | |
[[File:resEdit4.jpg]] | [[File:resEdit4.jpg]] | ||
| − | Step-5 | + | Step-5: |
[[File:resEdit5.jpg]] | [[File:resEdit5.jpg]] | ||
| − | Step-6 | + | Step-6: Double click on your '''.qrc''' file and it will open the file in a resource editor. Click on the Add prefix. |
| − | Double click on your .qrc file and it will open the file in a resource editor. Click on the Add prefix. | + | |
[[File:resEdit6.jpg]] | [[File:resEdit6.jpg]] | ||
| − | Step-7 | + | Step-7: After adding the prefix add the file to it. |
| − | After adding the prefix add the file to it. | + | |
[[File:resEdit7.jpg]] | [[File:resEdit7.jpg]] | ||
| − | Step-8 | + | 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. |
| − | 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. | + | |
[[File:resEdit8.jpg]] | [[File:resEdit8.jpg]] | ||
| − | Step-9 | + | Step-9: Open the Action editor and add a new action. a dialog shown below will appear. |
| − | Open the Action editor and add a new action. a dialog shown below will appear. | + | |
[[File:resEdit9.jpg]] | [[File:resEdit9.jpg]] | ||
| − | Step-10 | + | Step-10: For assigning the icon select the add resource and select your resource file. |
| − | For assigning the icon select the add resource and select your resource file. | + | |
[[File:resEdit10.jpg]] | [[File:resEdit10.jpg]] | ||
| Line 70: | Line 70: | ||
[[File:resEdit11.jpg]] | [[File:resEdit11.jpg]] | ||
| − | Step-12 | + | 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. |
| − | 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. | + | |
[[File:resEdit12.jpg]] | [[File:resEdit12.jpg]] | ||
Latest revision as of 06:54, 9 September 2011
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
Article
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-5:
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-11
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.













