Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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@9637 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Nov 14, 2008
1 parent 19bc6b9 commit e15424a
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions python/core/qgsmaplayer.sip
Expand Up @@ -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
{
Expand Down

0 comments on commit e15424a

Please sign in to comment.