##// END OF EJS Templates
jeandet -
r6:70816373a99c default
parent child
Show More
@@ -0,0 +1,175
1 #!/bin/bash
2
3 #
4 # file is included into the qmake systym in the common.prf file
5 #
6
7
8
9
10 #
11 #
12 #
13
14 main() {
15
16
17
18 verbose=0
19 fix_release_lib=1
20 fix_debug_lib=0
21
22 # parsing command line options
23 while getopts ":vh?dra" opt; do
24 case $opt in
25 h)
26 echo "Help for osx-file-dylib -[vh]
27 v : verbose output
28 d : fix debug libs
29 r : fix release libs (default)
30 a : fix all libs
31 " >&2
32 exit
33 ;;
34 v)
35 echo "-v was triggered!" >&2
36 verbose=1 # means it is on
37 ;;
38 d)
39 fix_debug_lib=1 # means it is on
40 ;;
41 r)
42 fix_release_lib=1 # means it is on
43 ;;
44 a)
45 fix_release_lib=1
46 fix_debug_lib=1
47 ;;
48 \?)
49 echo "Invalid option: -$OPTARG" >&2
50 ;;
51 esac
52 done
53
54
55
56 BASEPATH=`pwd`
57
58 if [ $verbose == 1 ] ; then
59 echo "Basepath = " $BASEPATH
60 ls -l *.dylib
61 fi
62
63
64 # first the release files
65 if [ $fix_release_lib == 1 ] ; then
66 fixit libPythonQt.1.0.0.dylib libPythonQt_QtAll.1.0.0.dylib $verbose
67 fi
68
69 # then the debug libs
70 if [ $fix_debug_lib == 1 ] ; then
71 fixit libPythonQt_d.1.0.0.dylib libPythonQt_QtAll_d.1.0.0.dylib $verbose
72 fi
73
74 if [ $verbose ] ; then
75 #tput bold
76 echo $LIBPYTHONQT
77 #tput sgr0
78 otool -L $LIBPYTHONQT
79 #install_name_tool -id $FULLLIBPYTHONQT $FULLLIBPYTHONQT
80 #otool -L $LIBPYTHONQT
81
82 #tput bold
83 echo $LIBPYTHONQTALL
84 #tput sgr0
85 otool -L $LIBPYTHONQTALL
86 #install_name_tool -id $FULLLIBPYTHONQTALL $FULLLIBPYTHONQTALL
87
88 #install_name_tool -change libPythonQt.1.dylib $FULLLIBPYTHONQT $LIBPYTHONQTALL
89
90 #otool -L $LIBPYTHONQTALL
91 fi
92 }
93
94
95
96
97
98
99
100 function fixit {
101 #
102 # fixit(LIBPYTHONQT, LIBPYTHONQTALL, VERBOSE)
103 #
104
105
106 LIBPYTHONQT=$1
107 LIBPYTHONQTALL=$2
108 VERBOSE=$3
109
110 BASEPATH=`pwd`
111 FULLLIBPYTHONQT=$BASEPATH"/"$LIBPYTHONQT
112 FULLLIBPYTHONQTALL=$BASEPATH"/"$LIBPYTHONQTALL
113
114
115 if [ -e $LIBPYTHONQT ]
116 then
117 #tput bold
118 echo "fixing " $LIBPYTHONQT
119 #tput sgr0
120 #otool -L $LIBPYTHONQT
121 install_name_tool -id $FULLLIBPYTHONQT $FULLLIBPYTHONQT
122 #otool -L $LIBPYTHONQT
123 else
124 #tput bold
125 echo "[Warning] " $LIBPYTHONQT " is missing here:" `pwd`
126 #tput sgr0
127 fi
128
129
130 if [ -e $LIBPYTHONQTALL ]
131 then
132 #tput bold
133 echo "fixing " $LIBPYTHONQTALL
134 #tput sgr0
135 #otool -L $LIBPYTHONQTALL
136 install_name_tool -id $FULLLIBPYTHONQTALL $FULLLIBPYTHONQTALL
137
138 echo "libPython:" $LIBPYTHONQT
139 # if debug then
140 if [[ $LIBPYTHONQTALL == *_d.*dylib ]]
141 then
142 LIBPYTHONQT1=libPythonQt_d.1.dylib
143 else
144 LIBPYTHONQT1=libPythonQt.1.dylib
145 fi
146
147 install_name_tool -change $LIBPYTHONQT1 $FULLLIBPYTHONQT $LIBPYTHONQTALL
148
149
150 #otool -L $LIBPYTHONQTALL
151 else
152 #tput bold
153 echo "[Warning] " $LIBPYTHONQTALL " is missing here:" `pwd`
154 #tput sgr0
155 fi
156
157
158
159 }
160
161
162
163 # now we actually call main
164 main $@
165
166
167
168
169
170
171
172
173
174
175
@@ -46,7 +46,9 endif()
46 if("${generated_cpp_suffix}" STREQUAL "_46")
46 if("${generated_cpp_suffix}" STREQUAL "_46")
47 set(generated_cpp_suffix "_47") # Also use 4.7 wrappers for 4.6.x version
47 set(generated_cpp_suffix "_47") # Also use 4.7 wrappers for 4.6.x version
48 endif()
48 endif()
49 if("${generated_cpp_suffix}" STREQUAL "_51")
49
50 # All 5.x use the same for now
51 if("${QT_VERSION_MAJOR}" STREQUAL "5")
50 set(generated_cpp_suffix "_50")
52 set(generated_cpp_suffix "_50")
51 endif()
53 endif()
52
54
@@ -1,5 +1,10
1 TEMPLATE = subdirs
1 TEMPLATE = subdirs
2
2
3 CONFIG += ordered
3 CONFIG += ordered
4 #SUBDIRS = src extensions tests examples generator_50
4 SUBDIRS = src extensions tests examples
5 SUBDIRS = src extensions generator_50
5
6 #contains(QT_MAJOR_VERSION, 5) {
7 #SUBDIRS += generator_50
8 #} else {
9 #SUBDIRS += generator
10 #}
@@ -58,7 +58,7 IF(Python_FIND_VERSION_EXACT)
58 ELSE(Python_FIND_VERSION_EXACT)
58 ELSE(Python_FIND_VERSION_EXACT)
59 # Version lists
59 # Version lists
60 SET(_PYTHON_3_KNOWN_VERSIONS ${PYTHON_3_ADDITIONAL_VERSIONS}
60 SET(_PYTHON_3_KNOWN_VERSIONS ${PYTHON_3_ADDITIONAL_VERSIONS}
61 "3.3" "3.2" "3.1" "3.0")
61 "3.4" "3.3" "3.2" "3.1" "3.0")
62 SET(_PYTHON_2_KNOWN_VERSIONS ${PYTHON_2_ADDITIONAL_VERSIONS}
62 SET(_PYTHON_2_KNOWN_VERSIONS ${PYTHON_2_ADDITIONAL_VERSIONS}
63 "2.7" "2.6" "2.5" "2.4" "2.3" "2.2" "2.1" "2.0" "1.6" "1.5")
63 "2.7" "2.6" "2.5" "2.4" "2.3" "2.2" "2.1" "2.0" "1.6" "1.5")
64 SET(_PYTHON_2_TEST_VERSIONS)
64 SET(_PYTHON_2_TEST_VERSIONS)
@@ -1,5 +1,6
1 #include <PythonQt.h>
1 #include <PythonQt.h>
2 #include <QtGui>
2 #include <QtGui>
3 #include <QApplication>
3
4
4 int main (int argc, char* argv[]) {
5 int main (int argc, char* argv[]) {
5 QApplication app(argc, argv);
6 QApplication app(argc, argv);
@@ -6,8 +6,14 mac:CONFIG -= app_bundle
6
6
7 DESTDIR = ../../lib
7 DESTDIR = ../../lib
8
8
9 contains(QT_MAJOR_VERSION, 5) {
10 QT += widgets
11 }
12
13
9 include ( ../../build/common.prf )
14 include ( ../../build/common.prf )
10 include ( ../../build/PythonQt.prf )
15 CONFIG+=BUILDING_QTALL
16 include ( ../../build/pythonqt.prf )
11
17
12 SOURCES += \
18 SOURCES += \
13 CPPPyWrapperExample.cpp
19 CPPPyWrapperExample.cpp
@@ -9,8 +9,9 contains(QT_MAJOR_VERSION, 5) {
9
9
10 mac:CONFIG-= app_bundle
10 mac:CONFIG-= app_bundle
11
11
12 include ( ../../build/common.prf )
12 include ( ../../build/common.prf )
13 include ( ../../build/PythonQt.prf )
13 CONFIG+=BUILDING_QTALL
14 include ( ../../build/pythonqt.prf )
14 include ( ../../build/PythonQt_QtAll.prf )
15 include ( ../../build/PythonQt_QtAll.prf )
15
16
16
17
@@ -9,8 +9,13 TEMPLATE = app
9
9
10 DESTDIR = ../../lib
10 DESTDIR = ../../lib
11
11
12 contains(QT_MAJOR_VERSION, 5) {
13 QT += widgets
14 }
15
12 include ( ../../build/common.prf )
16 include ( ../../build/common.prf )
13 include ( ../../build/PythonQt.prf )
17 CONFIG+=BUILDING_QTALL
18 include ( ../../build/pythonqt.prf )
14
19
15 HEADERS += \
20 HEADERS += \
16 CustomObjects.h
21 CustomObjects.h
@@ -9,6 +9,10 TEMPLATE = app
9
9
10 DESTDIR = ../../lib
10 DESTDIR = ../../lib
11
11
12 contains(QT_MAJOR_VERSION, 5) {
13 QT += widgets
14 }
15
12 include ( ../../build/common.prf )
16 include ( ../../build/common.prf )
13 include ( ../../build/PythonQt.prf )
17 include ( ../../build/PythonQt.prf )
14
18
@@ -10,8 +10,12 TEMPLATE = app
10 DESTDIR = ../../lib
10 DESTDIR = ../../lib
11
11
12 include ( ../../build/common.prf )
12 include ( ../../build/common.prf )
13 include ( ../../build/PythonQt.prf )
13 CONFIG+=BUILDING_QTALL
14 include ( ../../build/pythonqt.prf )
14
15
16 contains(QT_MAJOR_VERSION, 5) {
17 QT += widgets
18 }
15
19
16 HEADERS += \
20 HEADERS += \
17 PyExampleDecorators.h
21 PyExampleDecorators.h
@@ -89,6 +89,13 public slots:
89
89
90 // add a method to your own CPP object
90 // add a method to your own CPP object
91 int doSomething(YourCPPObject* obj, int arg1) { return obj->doSomething(arg1); }
91 int doSomething(YourCPPObject* obj, int arg1) { return obj->doSomething(arg1); }
92
93 // add a docstring to your own CPP object
94 QString doc_YourCPPObject() {return "A C++ Class object";}
95
96 // add a docstrint to YourCPPObject::doSomething
97 QString doc_YourCPPObject_doSomething() {return "this function does something";}
98
92 };
99 };
93
100
94
101
@@ -24,5 +24,11 print yourCpp.doSomething(3);
24 # show slots available on yourCpp
24 # show slots available on yourCpp
25 print dir(yourCpp)
25 print dir(yourCpp)
26
26
27 # show docstring of yourCpp
28 print yourCpp.__doc__
29
30 # show docstring of yourCpp.doSomething
31 print yourCpp.doSomething.__doc__
32
27 # destructor will be called:
33 # destructor will be called:
28 yourCpp = None
34 yourCpp = None
@@ -11,8 +11,13 DESTDIR = ../../lib
11
11
12 CONFIG += console
12 CONFIG += console
13
13
14 contains(QT_MAJOR_VERSION, 5) {
15 QT += widgets
16 }
17
14 include ( ../../build/common.prf )
18 include ( ../../build/common.prf )
15 include ( ../../build/PythonQt.prf )
19 CONFIG+=BUILDING_QTALL
20 include ( ../../build/pythonqt.prf )
16
21
17 SOURCES += \
22 SOURCES += \
18 main.cpp
23 main.cpp
@@ -11,8 +11,14 mac:CONFIG -= app_bundle
11
11
12 DESTDIR = ../../lib
12 DESTDIR = ../../lib
13
13
14 contains(QT_MAJOR_VERSION, 5) {
15 QT += widgets
16 }
17
18
14 include ( ../../build/common.prf )
19 include ( ../../build/common.prf )
15 include ( ../../build/PythonQt.prf )
20 CONFIG+=BUILDING_QTALL
21 include ( ../../build/pythonqt.prf )
16 include ( ../../build/PythonQt_QtAll.prf )
22 include ( ../../build/PythonQt_QtAll.prf )
17
23
18 SOURCES += \
24 SOURCES += \
@@ -11,8 +11,13 mac:CONFIG -= app_bundle
11
11
12 DESTDIR = ../../lib
12 DESTDIR = ../../lib
13
13
14 contains(QT_MAJOR_VERSION, 5) {
15 QT += widgets
16 }
17
14 include ( ../../build/common.prf )
18 include ( ../../build/common.prf )
15 include ( ../../build/PythonQt.prf )
19 CONFIG+=BUILDING_QTALL
20 include ( ../../build/pythonqt.prf )
16 include ( ../../build/PythonQt_QtAll.prf )
21 include ( ../../build/PythonQt_QtAll.prf )
17
22
18 SOURCES += \
23 SOURCES += \
@@ -74,7 +74,7 QMainWindow* PyExampleObject::createWind
74
74
75 QObject* PyExampleObject::findChild(QObject* o, const QString& name)
75 QObject* PyExampleObject::findChild(QObject* o, const QString& name)
76 {
76 {
77 return qFindChild<QObject*>(o, name);
77 return o->findChild<QObject*>(name);
78 }
78 }
79
79
80 QVariantMap PyExampleObject::testMap()
80 QVariantMap PyExampleObject::testMap()
@@ -9,11 +9,16 TEMPLATE = app
9
9
10 DESTDIR = ../../lib
10 DESTDIR = ../../lib
11
11
12 contains(QT_MAJOR_VERSION, 5) {
13 QT += widgets
14 }
15
12 mac:CONFIG-= app_bundle
16 mac:CONFIG-= app_bundle
13
17
14 include ( ../../build/common.prf )
18 include ( ../../build/common.prf )
15 include ( ../../build/PythonQt.prf )
19 CONFIG+=BUILDING_QTALL
16 include ( ../../build/PythonQt_QtAll.prf )
20 include ( ../../build/pythonqt.prf )
21 include ( ../../build/PythonQt_QtAll.prf )
17
22
18 HEADERS += \
23 HEADERS += \
19 PyExampleObject.h
24 PyExampleObject.h
@@ -6,4 +6,5 SUBDIRS = CPPPyWrapperExample \
6 PyGuiExample \
6 PyGuiExample \
7 PyDecoratorsExample \
7 PyDecoratorsExample \
8 PyScriptingConsole \
8 PyScriptingConsole \
9 PyLauncher
9 PyLauncher \
10 NicePyConsole
@@ -61,7 +61,5 namespace PythonQt_QtAll
61 // Does not compile yet:
61 // Does not compile yet:
62 // PythonQt_init_QtXmlPatterns(0);
62 // PythonQt_init_QtXmlPatterns(0);
63 // PythonQt_init_QtPhonon(0);
63 // PythonQt_init_QtPhonon(0);
64 };
64 }
65 };
65 }
66
67
1 NO CONTENT: modified file chmod 100644 => 100755
NO CONTENT: modified file chmod 100644 => 100755
1 NO CONTENT: modified file chmod 100644 => 100755
NO CONTENT: modified file chmod 100644 => 100755
@@ -71,6 +71,14 public:
71 explicit pp_output_iterator(std::string &__result):
71 explicit pp_output_iterator(std::string &__result):
72 _M_result (__result) {}
72 _M_result (__result) {}
73
73
74 // this copy constructor was needed for Visual Studio 2012 release builds:
75 inline pp_output_iterator &operator=(const pp_output_iterator& other)
76 {
77 *(std::iterator<std::output_iterator_tag, void, void, void, void>*)(this) = other;
78 _M_result = other._M_result;
79 return *this;
80 }
81
74 inline pp_output_iterator &operator=(typename _Container::const_reference __v)
82 inline pp_output_iterator &operator=(typename _Container::const_reference __v)
75 {
83 {
76 if (_M_result.capacity () == _M_result.size ())
84 if (_M_result.capacity () == _M_result.size ())
@@ -4539,6 +4539,7 PyObject* constScanLine(QImage* image, i
4539 <include file-name="QImage" location="global"/>
4539 <include file-name="QImage" location="global"/>
4540 <include file-name="QPixmap" location="global"/>
4540 <include file-name="QPixmap" location="global"/>
4541 </extra-includes>
4541 </extra-includes>
4542 <modify-function signature="event(QEvent*)" remove="all"/>
4542 <modify-function signature="setMimeData(QMimeData *, QClipboard::Mode)">
4543 <modify-function signature="setMimeData(QMimeData *, QClipboard::Mode)">
4543 <modify-argument index="1">
4544 <modify-argument index="1">
4544 <define-ownership class="java" owner="c++"/>
4545 <define-ownership class="java" owner="c++"/>
@@ -46,6 +46,7
46 <reference-count action="ignore"/>
46 <reference-count action="ignore"/>
47 </modify-argument>
47 </modify-argument>
48 </modify-function>
48 </modify-function>
49 <modify-function signature="event(QEvent*)" remove="all"/>
49 </object-type>
50 </object-type>
50 <object-type name="QWebPage::ExtensionOption"/>
51 <object-type name="QWebPage::ExtensionOption"/>
51 <object-type name="QWebPage::ChooseMultipleFilesExtensionOption"/>
52 <object-type name="QWebPage::ChooseMultipleFilesExtensionOption"/>
1 NO CONTENT: modified file chmod 100644 => 100755
NO CONTENT: modified file chmod 100644 => 100755
@@ -377,7 +377,7
377
377
378
378
379 <modify-function signature="QByteArray(const char*,int)" remove="all"/>
379 <modify-function signature="QByteArray(const char*,int)" remove="all"/>
380 <modify-function signature="QByteArray(const char*)" remove="all"/>
380 <modify-function signature="QByteArray(const char*)" remove="all"/>
381
381
382 <modify-function signature="at(int)const">
382 <modify-function signature="at(int)const">
383 <modify-argument index="1">
383 <modify-argument index="1">
@@ -9,6 +9,11
9 <enum-type name="QGLContext::BindOption" flags="QGLContext::BindOptions"/>
9 <enum-type name="QGLContext::BindOption" flags="QGLContext::BindOptions"/>
10 <enum-type name="QGLShader::ShaderTypeBit" flags="QGLShader::ShaderType"/>
10 <enum-type name="QGLShader::ShaderTypeBit" flags="QGLShader::ShaderType"/>
11
11
12 <enum-type name="QGLBuffer::Access"/>
13 <enum-type name="QGLBuffer::Type"/>
14 <enum-type name="QGLBuffer::UsagePattern"/>
15 <enum-type name="QGLFunctions::OpenGLFeature"/>
16 <enum-type name="QGLFormat::OpenGLContextProfile"/>
12
17
13 <namespace-type name="QGL">
18 <namespace-type name="QGL">
14 <include file-name="qgl.h" location="global"/>
19 <include file-name="qgl.h" location="global"/>
@@ -27,6 +32,8
27 </value-type>
32 </value-type>
28
33
29 <value-type name="QGLFramebufferObjectFormat"/>
34 <value-type name="QGLFramebufferObjectFormat"/>
35 <object-type name="QGLFunctions"/>
36 <object-type name="QGLBuffer"/>
30 <object-type name="QGLShader"/>
37 <object-type name="QGLShader"/>
31 <object-type name="QGLShaderProgram">
38 <object-type name="QGLShaderProgram">
32 <!-- Should be disambiguated later by fixing the native pointer API -->
39 <!-- Should be disambiguated later by fixing the native pointer API -->
@@ -546,6 +546,11 PythonQtClassWrapper* PythonQtPrivate::c
546 PyObject* typeDict = PyDict_New();
546 PyObject* typeDict = PyDict_New();
547 PyObject* moduleName = PyObject_GetAttrString(parentModule, "__name__");
547 PyObject* moduleName = PyObject_GetAttrString(parentModule, "__name__");
548 PyDict_SetItemString(typeDict, "__module__", moduleName);
548 PyDict_SetItemString(typeDict, "__module__", moduleName);
549 if (!info->doc().isNull()) {
550 PyObject* docStr = PythonQtConv::QStringToPyObject(info->doc());
551 PyDict_SetItemString(typeDict, "__doc__", docStr);
552 Py_DECREF(docStr);
553 }
549
554
550 PyObject* args = Py_BuildValue("OOO", className, baseClasses, typeDict);
555 PyObject* args = Py_BuildValue("OOO", className, baseClasses, typeDict);
551
556
@@ -1283,6 +1288,28 void PythonQtPrivate::addDecorators(QObj
1283 PythonQtClassInfo* classInfo = lookupClassInfoAndCreateIfNotPresent(nameOfClass);
1288 PythonQtClassInfo* classInfo = lookupClassInfoAndCreateIfNotPresent(nameOfClass);
1284 PythonQtSlotInfo* newSlot = new PythonQtSlotInfo(NULL, m, i, o, PythonQtSlotInfo::ClassDecorator);
1289 PythonQtSlotInfo* newSlot = new PythonQtSlotInfo(NULL, m, i, o, PythonQtSlotInfo::ClassDecorator);
1285 classInfo->addDecoratorSlot(newSlot);
1290 classInfo->addDecoratorSlot(newSlot);
1291 } else if (signature.startsWith("doc_")) {
1292 if ((decoTypes & DocstringDecorator) == 0) continue;
1293 QByteArray nameOfClassAndMethod = signature.mid(4, signature.indexOf('(')-4);
1294 QList<QByteArray> nameOfClassAndMethodAsList = nameOfClassAndMethod.split('_');
1295 QByteArray nameOfClass = nameOfClassAndMethodAsList.at(0);
1296 PythonQtClassInfo* classInfo = lookupClassInfoAndCreateIfNotPresent(nameOfClass);
1297 // TODO: make shure that the function does not take arguments and returns a QString
1298 QString docString;
1299 void* argList[1] = {&docString};
1300 o->qt_metacall(QMetaObject::InvokeMetaMethod, i, argList);
1301 if( nameOfClassAndMethodAsList.size() == 1 ) {
1302 // __doc__ of class itself
1303 classInfo->setDoc(docString);
1304 } else {
1305 // __doc__ of class method (e.g. public slot)
1306 QByteArray nameOfMethod = nameOfClassAndMethodAsList.at(1);
1307 PythonQtMemberInfo member = classInfo->member(nameOfMethod);
1308 // check if we really found a slot
1309 if( member._type == PythonQtMemberInfo::Slot || member._type == PythonQtMemberInfo::Signal ) {
1310 member._slot->setDoc(docString);
1311 }
1312 }
1286 } else {
1313 } else {
1287 if ((decoTypes & InstanceDecorator) == 0) continue;
1314 if ((decoTypes & InstanceDecorator) == 0) continue;
1288 const PythonQtMethodInfo* info = PythonQtMethodInfo::getCachedMethodInfo(m, NULL);
1315 const PythonQtMethodInfo* info = PythonQtMethodInfo::getCachedMethodInfo(m, NULL);
@@ -569,6 +569,7 public:
569 ConstructorDecorator = 2,
569 ConstructorDecorator = 2,
570 DestructorDecorator = 4,
570 DestructorDecorator = 4,
571 InstanceDecorator = 8,
571 InstanceDecorator = 8,
572 DocstringDecorator = 16,
572 AllDecorators = 0xffff
573 AllDecorators = 0xffff
573 };
574 };
574
575
@@ -602,6 +602,9 QString PythonQtClassInfo::help()
602 decorator();
602 decorator();
603 QString h;
603 QString h;
604 h += QString("--- ") + QString(className()) + QString(" ---\n");
604 h += QString("--- ") + QString(className()) + QString(" ---\n");
605
606 if (!_doc.isNull())
607 h += "Description:\n" + _doc + "\n";
605
608
606 if (_isQObject) {
609 if (_isQObject) {
607 h += "Properties:\n";
610 h += "Properties:\n";
@@ -187,6 +187,12 public:
187 //! clear all members that where cached as "NotFound"
187 //! clear all members that where cached as "NotFound"
188 void clearNotFoundCachedMembers();
188 void clearNotFoundCachedMembers();
189
189
190 //! set the python docstring (__doc__) for this class
191 void setDoc(const QString& str) {_doc=str;}
192
193 //! get the python docstring (__doc__) for this class
194 const QString& doc() const {return _doc;}
195
190 private:
196 private:
191 void createEnumWrappers();
197 void createEnumWrappers();
192 void createEnumWrappers(const QMetaObject* meta);
198 void createEnumWrappers(const QMetaObject* meta);
@@ -238,6 +244,8 private:
238
244
239 bool _isQObject;
245 bool _isQObject;
240 bool _enumsCreated;
246 bool _enumsCreated;
247
248 QString _doc;
241
249
242 };
250 };
243
251
@@ -181,13 +181,13 static void initializeSlots(PythonQtClas
181 }
181 }
182
182
183 if (typeSlots & PythonQt::Type_InplaceAdd) {
183 if (typeSlots & PythonQt::Type_InplaceAdd) {
184 wrap->_base.as_number.nb_add = (binaryfunc)PythonQtInstanceWrapper_iadd;
184 wrap->_base.as_number.nb_inplace_add = (binaryfunc)PythonQtInstanceWrapper_iadd;
185 }
185 }
186 if (typeSlots & PythonQt::Type_InplaceSubtract) {
186 if (typeSlots & PythonQt::Type_InplaceSubtract) {
187 wrap->_base.as_number.nb_subtract = (binaryfunc)PythonQtInstanceWrapper_isub;
187 wrap->_base.as_number.nb_inplace_subtract = (binaryfunc)PythonQtInstanceWrapper_isub;
188 }
188 }
189 if (typeSlots & PythonQt::Type_InplaceMultiply) {
189 if (typeSlots & PythonQt::Type_InplaceMultiply) {
190 wrap->_base.as_number.nb_multiply = (binaryfunc)PythonQtInstanceWrapper_imul;
190 wrap->_base.as_number.nb_inplace_multiply = (binaryfunc)PythonQtInstanceWrapper_imul;
191 }
191 }
192 if (typeSlots & PythonQt::Type_InplaceDivide) {
192 if (typeSlots & PythonQt::Type_InplaceDivide) {
193 #ifndef PY3K
193 #ifndef PY3K
@@ -101,6 +101,12 public:
101 //! add an alias for a typename, e.g. QObjectList and QList<QObject*>.
101 //! add an alias for a typename, e.g. QObjectList and QList<QObject*>.
102 static void addParameterTypeAlias(const QByteArray& alias, const QByteArray& name);
102 static void addParameterTypeAlias(const QByteArray& alias, const QByteArray& name);
103
103
104 //! set the docstirng
105 void setDoc(const QString& str) {_doc = str;}
106
107 //! get the docstring
108 const QString& doc() const {return _doc; }
109
104 protected:
110 protected:
105 static void fillParameterInfo(ParameterInfo& type, const QByteArray& name, PythonQtClassInfo* classInfo);
111 static void fillParameterInfo(ParameterInfo& type, const QByteArray& name, PythonQtClassInfo* classInfo);
106
112
@@ -111,6 +117,9 public:
111 static QHash<QByteArray, PythonQtMethodInfo*> _cachedSignatures;
117 static QHash<QByteArray, PythonQtMethodInfo*> _cachedSignatures;
112
118
113 QList<ParameterInfo> _parameters;
119 QList<ParameterInfo> _parameters;
120
121 //! stores the docstring
122 QString _doc;
114 };
123 };
115
124
116 //! stores information about a slot, including a next pointer to overloaded slots
125 //! stores information about a slot, including a next pointer to overloaded slots
@@ -413,8 +413,10 meth_dealloc(PythonQtSlotFunctionObject
413 }
413 }
414
414
415 static PyObject *
415 static PyObject *
416 meth_get__doc__(PythonQtSlotFunctionObject * /*m*/, void * /*closure*/)
416 meth_get__doc__(PythonQtSlotFunctionObject *m, void * /*closure*/)
417 {
417 {
418 if( !m->m_ml->doc().isEmpty() )
419 return PythonQtConv::QStringToPyObject(m->m_ml->doc());
418 Py_INCREF(Py_None);
420 Py_INCREF(Py_None);
419 return Py_None;
421 return Py_None;
420 }
422 }
@@ -10,9 +10,18 TEMPLATE = lib
10
10
11 DESTDIR = ../lib
11 DESTDIR = ../lib
12
12
13 CONFIG += qt dll
13 CONFIG += qt
14 CONFIG -= flat
14 CONFIG -= flat
15
15
16
17 # allow to choose static linking through the environment variable PYTHONQT_STATIC
18 PYTHONQT_STATIC = $$(PYTHONQT_STATIC)
19 isEmpty(PYTHONQT_STATIC) {
20 CONFIG += dll
21 } else {
22 CONFIG += static
23 }
24
16 contains(QT_MAJOR_VERSION, 5) {
25 contains(QT_MAJOR_VERSION, 5) {
17 QT += widgets
26 QT += widgets
18 }
27 }
@@ -25,28 +34,3 include ( ../build/common.prf )
25 include ( ../build/python.prf )
34 include ( ../build/python.prf )
26
35
27 include ( src.pri )
36 include ( src.pri )
28 #added by Aje for install QT dirs.
29 #Copyed from Qscintilla config ;).
30
31
32 pythoncfg.path = $$[QT_INSTALL_PREFIX]/mkspecs/features
33 pythoncfg.files = ../build/pythonqt.prf
34
35 target.path = $$[QT_INSTALL_LIBS]
36 isEmpty(target.path) {
37 target.path = $(QTDIR)/lib
38 }
39
40 header.path = $$[QT_INSTALL_HEADERS]/PythonQt
41 header.files = *.h
42 isEmpty(header.path) {
43 header.path = $(QTDIR)/include/PythonQt
44 header.files = *.h
45 }
46 guiheader.path = $$[QT_INSTALL_HEADERS]/PythonQt/gui
47 guiheader.files = gui/*.h
48 isEmpty(guiheader.path) {
49 guiheader.path = $(QTDIR)/include/PythonQt/gui
50 guiheader.files = gui/*.h
51 }
52 INSTALLS += header target guiheader pythoncfg
@@ -269,19 +269,19 void PythonQtTestSlotCalling::testCppFac
269
269
270 }
270 }
271
271
272 PQCppObject2Decorator::TestEnumFlag PQCppObject2Decorator::testEnumFlag1(PQCppObject2* obj, PQCppObject2Decorator::TestEnumFlag flag) {
272 PQCppObject2Decorator::TestEnumFlag PQCppObject2Decorator::testEnumFlag1(PQCppObject2* /*obj*/, PQCppObject2Decorator::TestEnumFlag flag) {
273 return flag;
273 return flag;
274 }
274 }
275
275
276 PQCppObject2::TestEnumFlag PQCppObject2Decorator::testEnumFlag2(PQCppObject2* obj, PQCppObject2::TestEnumFlag flag) {
276 PQCppObject2::TestEnumFlag PQCppObject2Decorator::testEnumFlag2(PQCppObject2* /*obj*/, PQCppObject2::TestEnumFlag flag) {
277 return flag;
277 return flag;
278 }
278 }
279
279
280 // with int overload
280 // with int overload
281 PQCppObject2Decorator::TestEnumFlag PQCppObject2Decorator::testEnumFlag3(PQCppObject2* obj, int flag) {
281 PQCppObject2Decorator::TestEnumFlag PQCppObject2Decorator::testEnumFlag3(PQCppObject2* /*obj*/, int /*flag*/) {
282 return (TestEnumFlag)-1;
282 return (TestEnumFlag)-1;
283 }
283 }
284 PQCppObject2Decorator::TestEnumFlag PQCppObject2Decorator::testEnumFlag3(PQCppObject2* obj, PQCppObject2Decorator::TestEnumFlag flag) {
284 PQCppObject2Decorator::TestEnumFlag PQCppObject2Decorator::testEnumFlag3(PQCppObject2* /*obj*/, PQCppObject2Decorator::TestEnumFlag flag) {
285 return flag;
285 return flag;
286 }
286 }
287
287
@@ -538,25 +538,25 void PythonQtTestApi::testQColorDecorato
538 QVERIFY(colorClass.call("red", QVariantList() << QColor(255,0,0)).toInt() == 255);
538 QVERIFY(colorClass.call("red", QVariantList() << QColor(255,0,0)).toInt() == 255);
539 }
539 }
540
540
541 QByteArray PythonQtTestApiHelper::readFileAsBytes(const QString& filename)
541 QByteArray PythonQtTestApiHelper::readFileAsBytes(const QString& /*filename*/)
542 {
542 {
543 QByteArray b;
543 QByteArray b;
544 return b;
544 return b;
545 }
545 }
546
546
547 QByteArray PythonQtTestApiHelper::readSourceFile(const QString& filename, bool& ok)
547 QByteArray PythonQtTestApiHelper::readSourceFile(const QString& /*filename*/, bool& ok)
548 {
548 {
549 QByteArray b;
549 QByteArray b;
550 ok = true;
550 ok = true;
551 return b;
551 return b;
552 }
552 }
553
553
554 bool PythonQtTestApiHelper::exists(const QString& filename)
554 bool PythonQtTestApiHelper::exists(const QString& /*filename*/)
555 {
555 {
556 return true;
556 return true;
557 }
557 }
558
558
559 QDateTime PythonQtTestApiHelper::lastModifiedDate(const QString& filename) {
559 QDateTime PythonQtTestApiHelper::lastModifiedDate(const QString& /*filename*/) {
560 return QDateTime::currentDateTime();
560 return QDateTime::currentDateTime();
561 }
561 }
562
562
@@ -240,10 +240,10 public slots:
240 PQCppObjectNoWrap* new_PQCppObjectNoWrap() {
240 PQCppObjectNoWrap* new_PQCppObjectNoWrap() {
241 return new PQCppObjectNoWrap(0);
241 return new PQCppObjectNoWrap(0);
242 }
242 }
243 PQCppObjectNoWrap* new_PQCppObjectNoWrap(const PQCppObjectNoWrap& other) {
243 PQCppObjectNoWrap* new_PQCppObjectNoWrap(const PQCppObjectNoWrap& /*other*/) {
244 return new PQCppObjectNoWrap(1);
244 return new PQCppObjectNoWrap(1);
245 }
245 }
246 PQCppObjectNoWrap* new_PQCppObjectNoWrap(double value) {
246 PQCppObjectNoWrap* new_PQCppObjectNoWrap(double /*value*/) {
247 return new PQCppObjectNoWrap(2);
247 return new PQCppObjectNoWrap(2);
248 }
248 }
249
249
@@ -352,13 +352,13 public slots:
352 void testNoArg() { _called = true; }
352 void testNoArg() { _called = true; }
353
353
354 //! overload test!
354 //! overload test!
355 void overload(bool a) { _calledOverload = 0; _called = true; }
355 void overload(bool) { _calledOverload = 0; _called = true; }
356 void overload(float a) { _calledOverload = 1; _called = true;}
356 void overload(float) { _calledOverload = 1; _called = true;}
357 void overload(int a) { _calledOverload = 2; _called = true;}
357 void overload(int) { _calledOverload = 2; _called = true;}
358 void overload(const QString& str) { _calledOverload = 3; _called = true;}
358 void overload(const QString&) { _calledOverload = 3; _called = true;}
359 void overload(const QStringList& str) { _calledOverload = 4; _called = true;}
359 void overload(const QStringList&) { _calledOverload = 4; _called = true;}
360 void overload(QObject* str) { _calledOverload = 5; _called = true;}
360 void overload(QObject*) { _calledOverload = 5; _called = true;}
361 void overload(float a, int b) { _calledOverload = 6; _called = true;}
361 void overload(float, int) { _calledOverload = 6; _called = true;}
362
362
363 //! POD values:
363 //! POD values:
364 int getInt(int a) { _called = true; return a; }
364 int getInt(int a) { _called = true; return a; }
@@ -5,19 +5,35
5 # --------------------------------------------------
5 # --------------------------------------------------
6 TARGET = PythonQtTest
6 TARGET = PythonQtTest
7 TEMPLATE = app
7 TEMPLATE = app
8 DESTDIR = ../lib
9
10 mac {
11 CONFIG -= app_bundle
12 }
13
14 QT += testlib
15
16 include ( ../build/common.prf )
17 CONFIG+=BUILDING_QTALL
18 include ( ../build/pythonqt.prf )
8
19
9 contains(QT_MAJOR_VERSION, 5) {
20 contains(QT_MAJOR_VERSION, 5) {
10 QT += testlib widgets
21 QT += widgets
11 } else {
12 CONFIG += qtestlib
13 }
22 }
14
23
15 include ( ../build/common.prf )
16 include ( ../build/PythonQt.prf )
17
18 HEADERS += \
24 HEADERS += \
19 PythonQtTests.h
25 PythonQtTests.h
20
26
21 SOURCES += \
27 SOURCES += \
22 PythonQtTestMain.cpp \
28 PythonQtTestMain.cpp \
23 PythonQtTests.cpp
29 PythonQtTests.cpp
30
31 # run the tests after compiling
32 macx {
33 QMAKE_POST_LINK = cd $${DESTDIR} && ./$${TARGET}
34 } else:win32 {
35 QMAKE_POST_LINK = \"$${DESTDIR}/$${TARGET}.exe\"
36 } else:unix {
37 # linux
38 QMAKE_POST_LINK = cd $${DESTDIR} && LD_LIBRARY_PATH=$$(LD_LIBRARY_PATH):./ xvfb-run -a ./$${TARGET}
39 }
General Comments 0
You need to be logged in to leave comments. Login now