How to use Resource Editor with Qt Creator
This article will explain, how the developer can use Resource Editor in the Qt Creator for setting icon and other resources for your application.
- Here it is assume that a user had a properly set the development environment for Qt application development. And also Qt sdk for windows is also installed.
- Check all the installation step here : Setting up Qt Development environment
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....
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.