[QGIS Commit] r9637 - trunk/qgis/python/core
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Fri Nov 14 18:42:08 EST 2008
Author: wonder
Date: 2008-11-14 18:42:08 -0500 (Fri, 14 Nov 2008)
New Revision: 9637
Modified:
trunk/qgis/python/core/qgsmaplayer.sip
Log:
PyQGIS fix: QgsMapLayer has QObject as subclass
(it wasn't possible to connect to its signals)
Modified: trunk/qgis/python/core/qgsmaplayer.sip
===================================================================
--- trunk/qgis/python/core/qgsmaplayer.sip 2008-11-14 18:44:36 UTC (rev 9636)
+++ trunk/qgis/python/core/qgsmaplayer.sip 2008-11-14 23:42:08 UTC (rev 9637)
@@ -3,22 +3,26 @@
* \brief Base class for all map layer types.
* This class is the base class for all map layer types (vector, raster).
*/
-class QgsMapLayer // TODO: problem when derived from QObject
+class QgsMapLayer : QObject
{
%TypeHeaderCode
#include <qgsmaplayer.h>
%End
%ConvertToSubClassCode
-
- if (sipCpp->type() == QgsMapLayer::VectorLayer)
+ if (sipCpp->inherits("QgsMapLayer"))
{
- sipClass = sipClass_QgsVectorLayer;
+ sipClass = sipClass_QgsMapLayer;
+ QgsMapLayer* layer = qobject_cast<QgsMapLayer*>(sipCpp);
+ if (layer->type() == QgsMapLayer::VectorLayer)
+ {
+ sipClass = sipClass_QgsVectorLayer;
+ }
+ else if (layer->type() == QgsMapLayer::RasterLayer)
+ {
+ sipClass = sipClass_QgsRasterLayer;
+ }
}
- else if (sipCpp->type() == QgsMapLayer::RasterLayer)
- {
- sipClass = sipClass_QgsRasterLayer;
- }
else
{
sipClass = 0;
More information about the QGIS-commit
mailing list