##// END OF EJS Templates
- added quitools...
florianlink -
r12:e79e720ed706
parent child
Show More
@@ -58,10 +58,8 int main( int argc, char **argv )
58 58 // Alternative 1: make CustomObject known and use decorators for wrapping:
59 59 // -----------------------------------------------------------------
60 60
61 // register the new object as a known classname
62 PythonQt::self()->registerCPPClassNames(QStringList() << "CustomObject");
63 // add a decorator which can access CustomObject instances
64 PythonQt::self()->addDecorators(new CustomObjectWrapper());
61 // register the new object as a known classname and add it's wrapper object
62 PythonQt::self()->registerCPPClass("CustomObject", "","", PythonQtCreateObject<CustomObjectWrapper>);
65 63
66 64 // -----------------------------------------------------------------
67 65 // Alternative 2: make CustomObject2 known and use a wrapper factory for wrapping:
@@ -72,7 +70,7 int main( int argc, char **argv )
72 70
73 71 // the following is optional and only needed if you want a constructor:
74 72 // register the new object as a known classname
75 PythonQt::self()->registerCPPClassNames(QStringList() << "CustomObject2");
73 PythonQt::self()->registerCPPClass("CustomObject2");
76 74 // add a constructor for CustomObject2
77 75 PythonQt::self()->addClassDecorators(new CustomObject2Constructor());
78 76
@@ -57,7 +57,7 int main( int argc, char **argv )
57 57 // register the type with QMetaType
58 58 qRegisterMetaType<CustomObject>("CustomObject");
59 59 // add a wrapper object for the new variant type
60 PythonQt::self()->registerCPPWrapper("CustomObject","","", PythonQtCreateObject<CustomObjectWrapper>);
60 PythonQt::self()->registerCPPClass("CustomObject","","", PythonQtCreateObject<CustomObjectWrapper>);
61 61
62 62 mainContext.evalFile(":example.py");
63 63
@@ -56,7 +56,7 int main( int argc, char **argv )
56 56
57 57 PythonQt::self()->addDecorators(new PyExampleDecorators());
58 58 PythonQt::self()->registerClass(&QPushButton::staticMetaObject);
59 PythonQt::self()->registerCPPClassNames(QStringList() << "YourCPPObject");
59 PythonQt::self()->registerCPPClass("YourCPPObject");
60 60
61 61 mainContext.evalFile(":example.py");
62 62
@@ -41,6 +41,7 void PythonQt_init_QtWebKit();
41 41 void PythonQt_init_QtOpenGL();
42 42 void PythonQt_init_QtXml();
43 43 void PythonQt_init_QtXmlPatterns();
44 void PythonQt_init_QtUiTools();
44 45 //void PythonQt_init_QtPhonon();
45 46
46 47 namespace PythonQt_QtAll
@@ -55,6 +56,7 namespace PythonQt_QtAll
55 56 PythonQt_init_QtSql();
56 57 PythonQt_init_QtWebKit();
57 58 PythonQt_init_QtOpenGL();
59 PythonQt_init_QtUiTools();
58 60 // PythonQt_init_QtPhonon();
59 61 };
60 62 };
@@ -3,7 +3,6 TARGET = PythonQt_QtAll
3 3 TEMPLATE = lib
4 4
5 5 DESTDIR = ../../lib
6 DLLDESTDIR = ../../lib
7 6
8 7 include ( ../../build/common.prf )
9 8 include ( ../../build/PythonQt.prf )
@@ -18,6 +17,7 HEADERS += \
18 17 SOURCES += \
19 18 PythonQt_QtAll.cpp
20 19
20 CONFIG += uitools
21 21 QT += webkit gui svg sql network xml xmlpatterns opengl
22 22 #QT += phonon
23 23
@@ -30,5 +30,6 include (../../generated_cpp/com_trolltech_qt_opengl/com_trolltech_qt_opengl.pri
30 30 include (../../generated_cpp/com_trolltech_qt_webkit/com_trolltech_qt_webkit.pri)
31 31 include (../../generated_cpp/com_trolltech_qt_xml/com_trolltech_qt_xml.pri)
32 32 include (../../generated_cpp/com_trolltech_qt_xmlpatterns/com_trolltech_qt_xmlpatterns.pri)
33 include (../../generated_cpp/com_trolltech_qt_uitools/com_trolltech_qt_uitools.pri)
33 34
34 35 #include (../../generated_cpp/com_trolltech_qt_phonon/com_trolltech_qt_phonon.pri)
@@ -28,7 +28,7
28 28
29 29 //#define Q_SCRIPT_LAZY_GENERATOR
30 30
31 void SetupGenerator::addClass(const AbstractMetaClass *cls)
31 void SetupGenerator::addClass(const AbstractMetaClass *cls)
32 32 {
33 33 packHash[cls->package()].append(cls);
34 34 }
@@ -59,7 +59,7 void SetupGenerator::generate()
59 59 }
60 60 packName.replace(".", "_");
61 61 packKey.replace(".", "_");
62
62
63 63 QString shortPackName;
64 64 foreach (QString comp, components) {
65 65 comp[0] = comp[0].toUpper();
@@ -72,26 +72,28 void SetupGenerator::generate()
72 72 shortPackName = "QtXmlPatterns";
73 73 } else if (shortPackName == "QtOpengl") {
74 74 shortPackName = "QtOpenGL";
75 }
76
77
75 } else if (shortPackName == "QtUitools") {
76 shortPackName = "QtUiTools";
77 }
78
79
78 80 {
79 81 FileOut initFile(m_out_dir + "/generated_cpp/" + packName + "/" + packKey + "_init.cpp");
80 82 QTextStream &s = initFile.stream;
81 83
82 84 if (FileOut::license)
83 85 writeQtScriptQtBindingsLicense(s);
84
86
85 87 s << "#include <PythonQt.h>" << endl;
86 88
87 89 foreach (const AbstractMetaClass *cls, list) {
88 90 s << "#include \"PythonQtWrapper_" << cls->name() << ".h\"" << endl;
89 91 }
90 92 s << endl;
91
93
92 94 // declare individual class creation functions
93 95 s << "void PythonQt_init_" << shortPackName << "() {" << endl;
94 QStringList cppClassNames;
96 QStringList cppClassNames;
95 97 foreach (const AbstractMetaClass *cls, list) {
96 98 if (ClassGenerator::isBuiltIn(cls->name())) { continue; }
97 99
@@ -103,7 +105,7 void SetupGenerator::generate()
103 105 }
104 106 }
105 107 s << endl;
106
108
107 109 s << "}";
108 110 s << endl;
109 111 }
General Comments 0
You need to be logged in to leave comments. Login now