mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
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
This commit is contained in:
parent
19bc6b9bd8
commit
e15424a23e
@ -3,21 +3,25 @@
|
|||||||
* \brief Base class for all map layer types.
|
* \brief Base class for all map layer types.
|
||||||
* This class is the base class for all map layer types (vector, raster).
|
* 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
|
%TypeHeaderCode
|
||||||
#include <qgsmaplayer.h>
|
#include <qgsmaplayer.h>
|
||||||
%End
|
%End
|
||||||
|
|
||||||
%ConvertToSubClassCode
|
%ConvertToSubClassCode
|
||||||
|
if (sipCpp->inherits("QgsMapLayer"))
|
||||||
if (sipCpp->type() == QgsMapLayer::VectorLayer)
|
|
||||||
{
|
{
|
||||||
sipClass = sipClass_QgsVectorLayer;
|
sipClass = sipClass_QgsMapLayer;
|
||||||
}
|
QgsMapLayer* layer = qobject_cast<QgsMapLayer*>(sipCpp);
|
||||||
else if (sipCpp->type() == QgsMapLayer::RasterLayer)
|
if (layer->type() == QgsMapLayer::VectorLayer)
|
||||||
{
|
{
|
||||||
sipClass = sipClass_QgsRasterLayer;
|
sipClass = sipClass_QgsVectorLayer;
|
||||||
|
}
|
||||||
|
else if (layer->type() == QgsMapLayer::RasterLayer)
|
||||||
|
{
|
||||||
|
sipClass = sipClass_QgsRasterLayer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user