Qt – Creating a resource file to use it in Qt Designer

pyqtqtqt-creatorrcc

I want to add a background image to a widget and thus I need a resource file but I am not able to create it in Qt Designer. Here is what I did:

  1. From the widget I go to the resources browser and click on the "add new file" button then a new window pops up.

  2. I am asked to point to the .qrc file but this file does not exist and I don't know how to create it.

I googled and found that .qrc files are created using Qt Creator.

Can't I create a .qrc file in Qt Designer ? Do I need to use Qt Creator to create a .qrc file and then use it in QT Designer ?

I am using Qt Designer with PyQt in CentOS 7.0

Best Answer

You only need Qt Designer, and it can be done very easily, like this:

  1. Open the Resource Browser (View -> Resource Browser)
  2. Click the Edit Resources button (first on the left)
  3. Click the New Resource File button (first on the left)
  4. Enter a file name (e.g. resources.qrc) and click Save
  5. Click the Add Prefix button (fourth from the left) and enter a name (e.g. images)
  6. Click the Add Files button (fifth from the left) and add your resources
Related Topic