Skip to content
Permalink
Browse files
PyQGIS fix: QgsMapLayer has QObject as subclass
(it wasn't possible to connect to its signals)


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9637 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Nov 14, 2008
1 parent 87816af commit 10e6f6056d4add5c63487a9b09cf932d66f5c1f7
Showing with 12 additions and 8 deletions.
  1. +12 −8 python/core/qgsmaplayer.sip
@@ -3,21 +3,25 @@
* \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)
{
sipClass = sipClass_QgsVectorLayer;
}
else if (sipCpp->type() == QgsMapLayer::RasterLayer)
if (sipCpp->inherits("QgsMapLayer"))
{
sipClass = sipClass_QgsRasterLayer;
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
{

0 comments on commit 10e6f60

Please sign in to comment.