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