[Qgis-developer] Images and button in Qt Designer

matteo matteo.ghetta at gmail.com
Fri May 6 01:04:21 PDT 2016


Hi guys,

I'm facing a very annoying problem. In some UI of a plugin I need to add 
some icons in a QPushButton.

Qt Designer allows to add icons in 2 ways (I think):

1. by choosing the file in the computer (so a simple image)
2. by adding images of a resource file

The 1. method doesn't give any trouble with QGIS but the icon is not 
visible once the plugin is loaded.

With the 2. method I have some problem in QGIS. Once saved the UI, Qt 
adds the following lines to the code (interface.ui file):


<resources>
   <include location="resources.qrc"/>
</resources>


and I've compiled the resource file with:


pyrcc4 -o resources.py resources.qrc


without any errors.
but this causes a crash of the plugin once loaded:


ImportError: No module named resources_rc


am I missing something?

Thanks to all

Cheers

Matteo


More information about the Qgis-developer mailing list