[Qgis-developer] RE: Python renderer plugin icon - solution

Chris Crook ccrook at linz.govt.nz
Wed Jan 27 18:03:19 EST 2010


PS: I've added this to the Symbology-NG page on the wiki -

http://www.qgis.org/wiki/Symbology-NG

Cheers
Chris

________________________________
From: qgis-developer-bounces at lists.osgeo.org [mailto:qgis-developer-bounces at lists.osgeo.org] On Behalf Of Chris Crook
Sent: Thursday, 28 January 2010 11:16 a.m.
To: qgis-developer at lists.osgeo.org
Subject: [Qgis-developer] RE: Python renderer plugin icon - solution .. almost

Hi

I've done some digging into this, and it seems that I can create an icon, but I have difficulty associating it with the renderer in the dialog.  The problem is in qgsrendererv2propertiesdialog.cpp, line 74, which reads:

    QString iconPath = QgsApplication::defaultThemePath() + m->iconName();
The problem I have my icon resource (built with pyrcc4) isn't necessarily on the default theme path.  I guess I could put it there, but that would depend on it not being changed.  I wonder if it would be better to code this as:

    QString iconPath = m->iconName();
    if( ! iconPath.startsWith(':')) iconPath = QgsApplication::defaultThemePath() +iconPath

That way I can use my own resource path, which avoids any possible conflict.

Is this something that could be implemented?

Thanks
Chris

________________________________
From: qgis-developer-bounces at lists.osgeo.org [mailto:qgis-developer-bounces at lists.osgeo.org] On Behalf Of Chris Crook
Sent: Wednesday, 27 January 2010 11:04 a.m.
To: qgis-developer at lists.osgeo.org
Subject: [Qgis-developer] Python renderer plugin icon

I'm wanting to associate an icon with a python based renderer plugin, so that it looks like the other renderers in the symbology dialog.  It seems that the icon defined by name in the QgsRendererV2AbstractMetadata constructor.

I guess that the icon name refers to the name of a QIcon resource, and I imagine that I can install the resource with this name somewhere as part of my initGui function of my plugin class factory.

However my knowledge of PyQt lets me down at this point.  Can anyone give me any clues as to how to build an icon resource from a .png file and how to install it so that it shows up as an icon in the Symbology dialog?

Thanks
Chris
________________________________
This message contains information, which is confidential and may be subject to legal privilege.
If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message.
If you have received this message in error, please notify us immediately (Phone 0800 665 463 or info at linz.govt.nz<mailto:sinfo at linz.govt.nz> ) and destroy the original message.
LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ.

Thank you.
________________________________
________________________________
This message contains information, which is confidential and may be subject to legal privilege.
If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message.
If you have received this message in error, please notify us immediately (Phone 0800 665 463 or info at linz.govt.nz<mailto:sinfo at linz.govt.nz> ) and destroy the original message.
LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ.

Thank you.
________________________________

______________________________________________________________________________________________________

This message contains information, which is confidential and may be subject to legal privilege. 
If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message.
If you have received this message in error, please notify us immediately (Phone 0800 665 463 or info at linz.govt.nz) and destroy the original message.
LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ.

Thank you.
______________________________________________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20100128/b7a11dce/attachment-0001.html


More information about the Qgis-developer mailing list