##// END OF EJS Templates
fixed example for 2.0 API, factory example still not working...
florianlink -
r152:d0d61419dda4
parent child
Show More
@@ -1,4 +1,4
1 <!DOCTYPE RCC><RCC version="1.0">
1 <!DOCTYPE RCC><RCC version="1.0">
2 <qresource>
2 <qresource>
3 <file>example.py</file>
3 <file>example.py</file>
4 </qresource>
4 </qresource>
@@ -1,4 +1,4
1 from PythonQt import *
1 from PythonQt.example import *
2
2
3 print "alternative 1 : CustomObject wrapped by decorators"
3 print "alternative 1 : CustomObject wrapped by decorators"
4
4
@@ -59,7 +59,7 int main( int argc, char **argv )
59 // -----------------------------------------------------------------
59 // -----------------------------------------------------------------
60
60
61 // register the new object as a known classname and add it's wrapper object
61 // register the new object as a known classname and add it's wrapper object
62 PythonQt::self()->registerCPPClass("CustomObject", "","", PythonQtCreateObject<CustomObjectWrapper>);
62 PythonQt::self()->registerCPPClass("CustomObject", "","example", PythonQtCreateObject<CustomObjectWrapper>);
63
63
64 // -----------------------------------------------------------------
64 // -----------------------------------------------------------------
65 // Alternative 2: make CustomObject2 known and use a wrapper factory for wrapping:
65 // Alternative 2: make CustomObject2 known and use a wrapper factory for wrapping:
@@ -70,7 +70,7 int main( int argc, char **argv )
70
70
71 // the following is optional and only needed if you want a constructor:
71 // the following is optional and only needed if you want a constructor:
72 // register the new object as a known classname
72 // register the new object as a known classname
73 PythonQt::self()->registerCPPClass("CustomObject2");
73 PythonQt::self()->registerCPPClass("CustomObject2", "", "example");
74 // add a constructor for CustomObject2
74 // add a constructor for CustomObject2
75 PythonQt::self()->addClassDecorators(new CustomObject2Constructor());
75 PythonQt::self()->addClassDecorators(new CustomObject2Constructor());
76
76
General Comments 0
You need to be logged in to leave comments. Login now