@@ -1,79 +1,79 | |||
|
1 |
#ifndef _PYTHONQT |
|
|
2 |
#define _PYTHONQT |
|
|
1 | #ifndef _PYTHONQTCLASSWRAPPER_H | |
|
2 | #define _PYTHONQTCLASSWRAPPER_H | |
|
3 | 3 | |
|
4 | 4 | /* |
|
5 | 5 | * |
|
6 | 6 | * Copyright (C) 2006 MeVis Research GmbH All Rights Reserved. |
|
7 | 7 | * |
|
8 | 8 | * This library is free software; you can redistribute it and/or |
|
9 | 9 | * modify it under the terms of the GNU Lesser General Public |
|
10 | 10 | * License as published by the Free Software Foundation; either |
|
11 | 11 | * version 2.1 of the License, or (at your option) any later version. |
|
12 | 12 | * |
|
13 | 13 | * This library is distributed in the hope that it will be useful, |
|
14 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 | 16 | * Lesser General Public License for more details. |
|
17 | 17 | * |
|
18 | 18 | * Further, this software is distributed without any warranty that it is |
|
19 | 19 | * free of the rightful claim of any third person regarding infringement |
|
20 | 20 | * or the like. Any license provided herein, whether implied or |
|
21 | 21 | * otherwise, applies only to this software file. Patent licenses, if |
|
22 | 22 | * any, provided herein do not apply to combinations of this program with |
|
23 | 23 | * other software, or any other product whatsoever. |
|
24 | 24 | * |
|
25 | 25 | * You should have received a copy of the GNU Lesser General Public |
|
26 | 26 | * License along with this library; if not, write to the Free Software |
|
27 | 27 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
28 | 28 | * |
|
29 | 29 | * Contact information: MeVis Research GmbH, Universitaetsallee 29, |
|
30 | 30 | * 28359 Bremen, Germany or: |
|
31 | 31 | * |
|
32 | 32 | * http://www.mevis.de |
|
33 | 33 | * |
|
34 | 34 | */ |
|
35 | 35 | |
|
36 | 36 | //---------------------------------------------------------------------------------- |
|
37 | 37 | /*! |
|
38 | 38 | // \file PythonQtClassWrapper.h |
|
39 | 39 | // \author Florian Link |
|
40 | 40 | // \author Last changed by $Author: florian $ |
|
41 | 41 | // \date 2006-05 |
|
42 | 42 | */ |
|
43 | 43 | //---------------------------------------------------------------------------------- |
|
44 | 44 | |
|
45 | 45 | #include <Python.h> |
|
46 | 46 | |
|
47 | 47 | #include "structmember.h" |
|
48 | 48 | #include "methodobject.h" |
|
49 | 49 | #include "compile.h" |
|
50 | 50 | #include "eval.h" |
|
51 | 51 | #include <QString> |
|
52 | 52 | |
|
53 | 53 | class PythonQtClassInfo; |
|
54 | 54 | class QObject; |
|
55 | 55 | struct QMetaObject; |
|
56 | 56 | |
|
57 | 57 | extern PyTypeObject PythonQtClassWrapper_Type; |
|
58 | 58 | |
|
59 | 59 | //--------------------------------------------------------------- |
|
60 | 60 | //! a Python wrapper object for Qt meta objects |
|
61 | 61 | typedef struct { |
|
62 | 62 | PyObject_HEAD |
|
63 | 63 | |
|
64 | 64 | //! the class information (which contains the meta object as well) |
|
65 | 65 | PythonQtClassInfo* _info; |
|
66 | 66 | |
|
67 | 67 | } PythonQtClassWrapper; |
|
68 | 68 | |
|
69 | 69 | //--------------------------------------------------------------- |
|
70 | 70 | // an abstact class for handling construction of objects |
|
71 | 71 | class PythonQtConstructorHandler { |
|
72 | 72 | public: |
|
73 | 73 | //! get rid of warnings |
|
74 | 74 | virtual ~PythonQtConstructorHandler() {} |
|
75 | 75 | |
|
76 | 76 | virtual QObject* create(const QMetaObject* meta, PyObject *args, PyObject *kw, QString& error) = 0; |
|
77 | 77 | }; |
|
78 | 78 | |
|
79 | 79 | #endif No newline at end of file |
@@ -1,92 +1,92 | |||
|
1 | #ifndef _PYTHONQTWRAPPER_H | |
|
2 | #define _PYTHONQTWRAPPER_H | |
|
1 | #ifndef _PYTHONQTINSTANCEWRAPPER_H | |
|
2 | #define _PYTHONQTINSTANCEWRAPPER_H | |
|
3 | 3 | |
|
4 | 4 | /* |
|
5 | 5 | * |
|
6 | 6 | * Copyright (C) 2006 MeVis Research GmbH All Rights Reserved. |
|
7 | 7 | * |
|
8 | 8 | * This library is free software; you can redistribute it and/or |
|
9 | 9 | * modify it under the terms of the GNU Lesser General Public |
|
10 | 10 | * License as published by the Free Software Foundation; either |
|
11 | 11 | * version 2.1 of the License, or (at your option) any later version. |
|
12 | 12 | * |
|
13 | 13 | * This library is distributed in the hope that it will be useful, |
|
14 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 | 16 | * Lesser General Public License for more details. |
|
17 | 17 | * |
|
18 | 18 | * Further, this software is distributed without any warranty that it is |
|
19 | 19 | * free of the rightful claim of any third person regarding infringement |
|
20 | 20 | * or the like. Any license provided herein, whether implied or |
|
21 | 21 | * otherwise, applies only to this software file. Patent licenses, if |
|
22 | 22 | * any, provided herein do not apply to combinations of this program with |
|
23 | 23 | * other software, or any other product whatsoever. |
|
24 | 24 | * |
|
25 | 25 | * You should have received a copy of the GNU Lesser General Public |
|
26 | 26 | * License along with this library; if not, write to the Free Software |
|
27 | 27 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
28 | 28 | * |
|
29 | 29 | * Contact information: MeVis Research GmbH, Universitaetsallee 29, |
|
30 | 30 | * 28359 Bremen, Germany or: |
|
31 | 31 | * |
|
32 | 32 | * http://www.mevis.de |
|
33 | 33 | * |
|
34 | 34 | */ |
|
35 | 35 | |
|
36 | 36 | //---------------------------------------------------------------------------------- |
|
37 | 37 | /*! |
|
38 | 38 | // \file PythonQtInstanceWrapper.h |
|
39 | 39 | // \author Florian Link |
|
40 | 40 | // \author Last changed by $Author: florian $ |
|
41 | 41 | // \date 2006-05 |
|
42 | 42 | */ |
|
43 | 43 | //---------------------------------------------------------------------------------- |
|
44 | 44 | |
|
45 | 45 | #include <Python.h> |
|
46 | 46 | |
|
47 | 47 | #include "PythonQtSystem.h" |
|
48 | 48 | #include <QPointer> |
|
49 | 49 | |
|
50 | 50 | #include "structmember.h" |
|
51 | 51 | #include "methodobject.h" |
|
52 | 52 | #include "compile.h" |
|
53 | 53 | #include "eval.h" |
|
54 | 54 | |
|
55 | 55 | class PythonQtClassInfo; |
|
56 | 56 | class QObject; |
|
57 | 57 | |
|
58 | 58 | extern PYTHONQT_EXPORT PyTypeObject PythonQtInstanceWrapper_Type; |
|
59 | 59 | |
|
60 | 60 | //--------------------------------------------------------------- |
|
61 | 61 | //! a Python wrapper object for Qt objects and C++ objects (that are themselves wrapped by wrapper QObjects) |
|
62 | 62 | typedef struct { |
|
63 | 63 | PyObject_HEAD |
|
64 | 64 | |
|
65 | 65 | //! set the QObject pointer |
|
66 | 66 | void setQObject(QObject* object) { |
|
67 | 67 | _obj = object; |
|
68 | 68 | _objPointerCopy = object; |
|
69 | 69 | } |
|
70 | 70 | |
|
71 | 71 | //! pointer to the wrapped Qt object or if _wrappedPtr is set, the Qt object that wraps the C++ Ptr |
|
72 | 72 | QPointer<QObject> _obj; |
|
73 | 73 | //! a copy of the _obj pointer, which is required because the wrapper needs to |
|
74 | 74 | //! deregister itself via the _obj pointer, even when the QPointer<QObject> object was destroyed |
|
75 | 75 | void* _objPointerCopy; |
|
76 | 76 | |
|
77 | 77 | //! optional C++ object Ptr that is wrapped by the above _obj |
|
78 | 78 | void* _wrappedPtr; |
|
79 | 79 | |
|
80 | 80 | //! the class information, this is set even if the _obj or _wrappedPtr is NULL to support typed NULL pointers |
|
81 | 81 | PythonQtClassInfo* _info; |
|
82 | 82 | |
|
83 | 83 | //! flag that stores if the object is owned by pythonQt |
|
84 | 84 | bool _ownedByPythonQt; |
|
85 | 85 | |
|
86 | 86 | //! stores that the owned object should be destroyed using QMetaType::destroy() |
|
87 | 87 | bool _useQMetaTypeDestroy; |
|
88 | 88 | |
|
89 | 89 | } PythonQtInstanceWrapper; |
|
90 | 90 | |
|
91 | 91 | |
|
92 | 92 | #endif No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now