Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm unable to setup the display of the toolbar icon for a plugin in QGIS 2.0. I have compiled the "resources.qrc" with the correct path and filename, and checked possible spelling errors in the code.

In fact, the icon is displayed in the plugin manager but not on the toolbar or the dropdown menu (?). The plugin has been started using the plugin builder for 1.8 version, but works just fine. The plugin folder is linked to the qgis plugins folder by a symlink on a linux system.

Thanks.

Edit: my qrc file :

<RCC>
    <qresource prefix="/plugins/ViewshedAnalysis" >
        <file>icon.png</file>
    </qresource>
</RCC>

and my code :

self.action = QAction(
        QIcon(":/plugins/ViewshedAnalysis/icon.png"),
        u"Viewshed", self.iface.mainWindow())
QObject.connect(self.action, SIGNAL("triggered()"), self.run)


# Add toolbar button and menu item
self.iface.addToolBarIcon(self.action)
self.iface.addPluginToMenu(u"&Viewshed Analysis", self.action)
share|improve this question
    
What do you see in the icons place? Nothing? –  Nathan W Dec 10 '13 at 12:12
    
yes, it's empty –  Zoran Dec 10 '13 at 13:06
    
Can you past your resources.qrc and and example of you loading the icon. –  Nathan W Dec 10 '13 at 13:07
1  
did you import your compiled resource? import resources_rc –  Matthias Kuhn Dec 11 '13 at 9:10
    
Bingo! I do import the resources, but with a small typo ... so now it works perfectly! (I would never figure thos out :) –  Zoran Dec 12 '13 at 13:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.