File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 3
3
* \brief Base class for all map layer types.
4
4
* This class is the base class for all map layer types (vector, raster).
5
5
*/
6
- class QgsMapLayer // TODO: problem when derived from QObject
6
+ class QgsMapLayer : QObject
7
7
{
8
8
%TypeHeaderCode
9
9
#include <qgsmaplayer.h>
10
10
%End
11
11
12
12
%ConvertToSubClassCode
13
-
14
- if (sipCpp->type() == QgsMapLayer::VectorLayer)
15
- {
16
- sipClass = sipClass_QgsVectorLayer;
17
- }
18
- else if (sipCpp->type() == QgsMapLayer::RasterLayer)
13
+ if (sipCpp->inherits("QgsMapLayer"))
19
14
{
20
- sipClass = sipClass_QgsRasterLayer;
15
+ sipClass = sipClass_QgsMapLayer;
16
+ QgsMapLayer* layer = qobject_cast<QgsMapLayer*>(sipCpp);
17
+ if (layer->type() == QgsMapLayer::VectorLayer)
18
+ {
19
+ sipClass = sipClass_QgsVectorLayer;
20
+ }
21
+ else if (layer->type() == QgsMapLayer::RasterLayer)
22
+ {
23
+ sipClass = sipClass_QgsRasterLayer;
24
+ }
21
25
}
22
26
else
23
27
{
You can’t perform that action at this time.
0 commit comments