Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Improve Python API - Cast class
Grum 999b8d0dab7ed58
diff --git a/plugins/extensions/pykrita/sip/krita/Canvas.sip b/plugins/extensions/pykrita/sip/krita/Canvas.sipindex 7eed0f2a71..a479819102 100644--- a/plugins/extensions/pykrita/sip/krita/Canvas.sip+++ b/plugins/extensions/pykrita/sip/krita/Canvas.sip@@ -3,6 +3,18 @@ class Canvas : QObject%TypeHeaderCode#include "Canvas.h"%End++%ConvertToSubClassCode+ // Need to add sub class conversion, otherwise a Canvas passed to a Signal is provided as a QObject instead of+ // a Canvas object+ // (not sure why, but explicit conversion here fix the problem)+ Canvas* mc = qobject_cast<Canvas*>(sipCpp);+ sipType = 0;+ if (mc) {+ sipType = sipType_Canvas;+ }+%End+Canvas(const Canvas & __0);public:bool operator==(const Canvas &other) const;diff --git a/plugins/extensions/pykrita/sip/krita/Channel.sip b/plugins/extensions/pykrita/sip/krita/Channel.sipindex d434402ea1..c8ca06116c 100644--- a/plugins/extensions/pykrita/sip/krita/Channel.sip+++ b/plugins/extensions/pykrita/sip/krita/Channel.sip@@ -3,6 +3,18 @@ class Channel : QObject%TypeHeaderCode#include "Channel.h"%End++%ConvertToSubClassCode+ // Need to add sub class conversion, otherwise a Channel passed to a Signal is provided as a QObject instead of+ // a Channel object+ // (not sure why, but explicit conversion here fix the problem)+ Channel* mc = qobject_cast<Channel*>(sipCpp);+ sipType = 0;+ if (mc) {+ sipType = sipType_Channel;+ }+%End+Channel(const Channel & __0);public:virtual ~Channel();diff --git a/plugins/extensions/pykrita/sip/krita/Document.sip b/plugins/extensions/pykrita/sip/krita/Document.sipindex d6a5e85138..44c30c6e30 100644--- a/plugins/extensions/pykrita/sip/krita/Document.sip+++ b/plugins/extensions/pykrita/sip/krita/Document.sip@@ -3,6 +3,18 @@ class Document : QObject /NoDefaultCtors/%TypeHeaderCode#include "Document.h"%End++%ConvertToSubClassCode+ // Need to add sub class conversion, otherwise a Document passed to a Signal is provided as a QObject instead of+ // a Document object+ // (not sure why, but explicit conversion here fix the problem)+ Document* mc = qobject_cast<Document*>(sipCpp);+ sipType = 0;+ if (mc) {+ sipType = sipType_Document;+ }+%End+Document(const Document & __0);public:bool operator==(const Document &other) const;diff --git a/plugins/extensions/pykrita/sip/krita/Filter.sip b/plugins/extensions/pykrita/sip/krita/Filter.sipindex a6106841cb..2fc8d4b5f0 100644--- a/plugins/extensions/pykrita/sip/krita/Filter.sip+++ b/plugins/extensions/pykrita/sip/krita/Filter.sip@@ -3,6 +3,18 @@ class Filter : QObject%TypeHeaderCode#include "Filter.h"%End++%ConvertToSubClassCode+ // Need to add sub class conversion, otherwise a Filter passed to a Signal is provided as a QObject instead of+ // a Filter object+ // (not sure why, but explicit conversion here fix the problem)+ Filter* mc = qobject_cast<Filter*>(sipCpp);+ sipType = 0;+ if (mc) {+ sipType = sipType_Filter;+ }+%End+Filter(const Filter & __0);public:diff --git a/plugins/extensions/pykrita/sip/krita/InfoObject.sip b/plugins/extensions/pykrita/sip/krita/InfoObject.sipindex 775a81354f..7ec8c7fc7d 100644--- a/plugins/extensions/pykrita/sip/krita/InfoObject.sip+++ b/plugins/extensions/pykrita/sip/krita/InfoObject.sip@@ -3,6 +3,18 @@ class InfoObject : QObject%TypeHeaderCode#include "InfoObject.h"%End++%ConvertToSubClassCode+ // Need to add sub class conversion, otherwise a InfoObject passed to a Signal is provided as a QObject instead of+ // a InfoObject object+ // (not sure why, but explicit conversion here fix the problem)+ InfoObject* mc = qobject_cast<InfoObject*>(sipCpp);+ sipType = 0;+ if (mc) {+ sipType = sipType_InfoObject;+ }+%End+InfoObject(const InfoObject & __0);public:bool operator==(const InfoObject &other) const;diff --git a/plugins/extensions/pykrita/sip/krita/ManagedColor.sip b/plugins/extensions/pykrita/sip/krita/ManagedColor.sipindex 104c589e9c..321ceedb66 100644--- a/plugins/extensions/pykrita/sip/krita/ManagedColor.sip+++ b/plugins/extensions/pykrita/sip/krita/ManagedColor.sip@@ -3,6 +3,18 @@ class ManagedColor : QObject%TypeHeaderCode#include "ManagedColor.h"%End++%ConvertToSubClassCode+ // Need to add sub class conversion, otherwise a ManagedColor passed to a Signal is provided as a QObject instead of+ // a ManagedColor object+ // (not sure why, but explicit conversion here fix the problem)+ ManagedColor* mc = qobject_cast<ManagedColor*>(sipCpp);+ sipType = 0;+ if (mc) {+ sipType = sipType_ManagedColor;+ }+%End+ManagedColor(const ManagedColor & __0);public:ManagedColor(const QString &colorModel, const QString &colorDepth, const QString &colorProfile, QObject *parent = 0);diff --git a/plugins/extensions/pykrita/sip/krita/Node.sip b/plugins/extensions/pykrita/sip/krita/Node.sipindex 3066bfbb3e..5fe7daeacb 100644--- a/plugins/extensions/pykrita/sip/krita/Node.sip+++ b/plugins/extensions/pykrita/sip/krita/Node.sip@@ -3,6 +3,18 @@ class Node : QObject%TypeHeaderCode#include "Node.h"%End++%ConvertToSubClassCode+ // Need to add sub class conversion, otherwise a Node passed to a Signal is provided as a QObject instead of+ // a Node object+ // (not sure why, but explicit conversion here fix the problem)+ Node* mc = qobject_cast<Node*>(sipCpp);+ sipType = 0;+ if (mc) {+ sipType = sipType_Node;+ }+%End+Node(const Node & __0);public:virtual ~Node();diff --git a/plugins/extensions/pykrita/sip/krita/Resource.sip b/plugins/extensions/pykrita/sip/krita/Resource.sipindex 360516e640..e5997b0eca 100644--- a/plugins/extensions/pykrita/sip/krita/Resource.sip+++ b/plugins/extensions/pykrita/sip/krita/Resource.sip@@ -3,6 +3,18 @@ class Resource : QObject%TypeHeaderCode#include "Resource.h"%End++%ConvertToSubClassCode+ // Need to add sub class conversion, otherwise a Resource passed to a Signal is provided as a QObject instead of+ // a Resource object+ // (not sure why, but explicit conversion here fix the problem)+ Resource* mc = qobject_cast<Resource*>(sipCpp);+ sipType = 0;+ if (mc) {+ sipType = sipType_Resource;+ }+%End+Resource(const Resource & __0);public:bool operator==(const Resource &other) const;diff --git a/plugins/extensions/pykrita/sip/krita/Selection.sip b/plugins/extensions/pykrita/sip/krita/Selection.sipindex f4562edefa..b012ab2181 100644--- a/plugins/extensions/pykrita/sip/krita/Selection.sip+++ b/plugins/extensions/pykrita/sip/krita/Selection.sip@@ -3,6 +3,18 @@ class Selection : QObject%TypeHeaderCode#include "Selection.h"%End++%ConvertToSubClassCode+ // Need to add sub class conversion, otherwise a Selection passed to a Signal is provided as a QObject instead of+ // a Selection object+ // (not sure why, but explicit conversion here fix the problem)+ Selection* mc = qobject_cast<Selection*>(sipCpp);+ sipType = 0;+ if (mc) {+ sipType = sipType_Selection;+ }+%End+Selection(const Selection & __0);public:Selection(QObject* parent /TransferThis/ = 0);diff --git a/plugins/extensions/pykrita/sip/krita/Shape.sip b/plugins/extensions/pykrita/sip/krita/Shape.sipindex fc8f7c345f..8a29f04b94 100644--- a/plugins/extensions/pykrita/sip/krita/Shape.sip+++ b/plugins/extensions/pykrita/sip/krita/Shape.sip@@ -3,6 +3,18 @@ class Shape : QObject%TypeHeaderCode#include "Shape.h"%End++%ConvertToSubClassCode+ // Need to add sub class conversion, otherwise a Shape passed to a Signal is provided as a QObject instead of+ // a Shape object+ // (not sure why, but explicit conversion here fix the problem)+ Shape* mc = qobject_cast<Shape*>(sipCpp);+ sipType = 0;+ if (mc) {+ sipType = sipType_Shape;+ }+%End+Shape(const Shape & __0);virtual ~Shape();bool operator==(const Shape &other) const;diff --git a/plugins/extensions/pykrita/sip/krita/Window.sip b/plugins/extensions/pykrita/sip/krita/Window.sipindex aeeafbedac..e669298d9c 100644--- a/plugins/extensions/pykrita/sip/krita/Window.sip+++ b/plugins/extensions/pykrita/sip/krita/Window.sip@@ -3,6 +3,18 @@ class Window : QObject%TypeHeaderCode#include "Window.h"%End++%ConvertToSubClassCode+ // Need to add sub class conversion, otherwise a Window passed to a Signal is provided as a QObject instead of+ // a Window object+ // (not sure why, but explicit conversion here fix the problem)+ Window* mc = qobject_cast<Window*>(sipCpp);+ sipType = 0;+ if (mc) {+ sipType = sipType_Window;+ }+%End+Window(const Window & __0);public:bool operator==(const Window &other) const;