# HG changeset patch # User jeandet # Date 2014-05-17 13:35:06 # Node ID 70816373a99c71d75c02499beaba8f248b4f8101 # Parent 0ffe7cbccf2e96aaf490deaeee05b9d58a304034 Pulled changes from https://github.com/Orochimarufan/PythonQt. diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,9 @@ endif() if("${generated_cpp_suffix}" STREQUAL "_46") set(generated_cpp_suffix "_47") # Also use 4.7 wrappers for 4.6.x version endif() -if("${generated_cpp_suffix}" STREQUAL "_51") + +# All 5.x use the same for now +if("${QT_VERSION_MAJOR}" STREQUAL "5") set(generated_cpp_suffix "_50") endif() diff --git a/PythonQt.pro b/PythonQt.pro --- a/PythonQt.pro +++ b/PythonQt.pro @@ -1,5 +1,10 @@ TEMPLATE = subdirs CONFIG += ordered -#SUBDIRS = src extensions tests examples generator_50 -SUBDIRS = src extensions generator_50 +SUBDIRS = src extensions tests examples + +#contains(QT_MAJOR_VERSION, 5) { +#SUBDIRS += generator_50 +#} else { +#SUBDIRS += generator +#} diff --git a/cmake/FindPython.cmake b/cmake/FindPython.cmake --- a/cmake/FindPython.cmake +++ b/cmake/FindPython.cmake @@ -58,7 +58,7 @@ IF(Python_FIND_VERSION_EXACT) ELSE(Python_FIND_VERSION_EXACT) # Version lists SET(_PYTHON_3_KNOWN_VERSIONS ${PYTHON_3_ADDITIONAL_VERSIONS} - "3.3" "3.2" "3.1" "3.0") + "3.4" "3.3" "3.2" "3.1" "3.0") SET(_PYTHON_2_KNOWN_VERSIONS ${PYTHON_2_ADDITIONAL_VERSIONS} "2.7" "2.6" "2.5" "2.4" "2.3" "2.2" "2.1" "2.0" "1.6" "1.5") SET(_PYTHON_2_TEST_VERSIONS) diff --git a/examples/CPPPyWrapperExample/CPPPyWrapperExample.cpp b/examples/CPPPyWrapperExample/CPPPyWrapperExample.cpp --- a/examples/CPPPyWrapperExample/CPPPyWrapperExample.cpp +++ b/examples/CPPPyWrapperExample/CPPPyWrapperExample.cpp @@ -1,5 +1,6 @@ #include #include +#include int main (int argc, char* argv[]) { QApplication app(argc, argv); diff --git a/examples/CPPPyWrapperExample/CPPPyWrapperExample.pro b/examples/CPPPyWrapperExample/CPPPyWrapperExample.pro --- a/examples/CPPPyWrapperExample/CPPPyWrapperExample.pro +++ b/examples/CPPPyWrapperExample/CPPPyWrapperExample.pro @@ -6,8 +6,14 @@ mac:CONFIG -= app_bundle DESTDIR = ../../lib +contains(QT_MAJOR_VERSION, 5) { + QT += widgets +} + + include ( ../../build/common.prf ) -include ( ../../build/PythonQt.prf ) +CONFIG+=BUILDING_QTALL +include ( ../../build/pythonqt.prf ) SOURCES += \ CPPPyWrapperExample.cpp diff --git a/examples/NicePyConsole/NicePyConsole.pro b/examples/NicePyConsole/NicePyConsole.pro --- a/examples/NicePyConsole/NicePyConsole.pro +++ b/examples/NicePyConsole/NicePyConsole.pro @@ -9,8 +9,9 @@ contains(QT_MAJOR_VERSION, 5) { mac:CONFIG-= app_bundle -include ( ../../build/common.prf ) -include ( ../../build/PythonQt.prf ) +include ( ../../build/common.prf ) +CONFIG+=BUILDING_QTALL +include ( ../../build/pythonqt.prf ) include ( ../../build/PythonQt_QtAll.prf ) diff --git a/examples/PyCPPWrapperExample/PyCPPWrapperExample.pro b/examples/PyCPPWrapperExample/PyCPPWrapperExample.pro --- a/examples/PyCPPWrapperExample/PyCPPWrapperExample.pro +++ b/examples/PyCPPWrapperExample/PyCPPWrapperExample.pro @@ -9,8 +9,13 @@ TEMPLATE = app DESTDIR = ../../lib +contains(QT_MAJOR_VERSION, 5) { + QT += widgets +} + include ( ../../build/common.prf ) -include ( ../../build/PythonQt.prf ) +CONFIG+=BUILDING_QTALL +include ( ../../build/pythonqt.prf ) HEADERS += \ CustomObjects.h diff --git a/examples/PyCustomMetaTypeExample/PyCustomMetaTypeExample.pro b/examples/PyCustomMetaTypeExample/PyCustomMetaTypeExample.pro --- a/examples/PyCustomMetaTypeExample/PyCustomMetaTypeExample.pro +++ b/examples/PyCustomMetaTypeExample/PyCustomMetaTypeExample.pro @@ -9,6 +9,10 @@ TEMPLATE = app DESTDIR = ../../lib +contains(QT_MAJOR_VERSION, 5) { + QT += widgets +} + include ( ../../build/common.prf ) include ( ../../build/PythonQt.prf ) diff --git a/examples/PyDecoratorsExample/PyDecoratorsExample.pro b/examples/PyDecoratorsExample/PyDecoratorsExample.pro --- a/examples/PyDecoratorsExample/PyDecoratorsExample.pro +++ b/examples/PyDecoratorsExample/PyDecoratorsExample.pro @@ -10,8 +10,12 @@ TEMPLATE = app DESTDIR = ../../lib include ( ../../build/common.prf ) -include ( ../../build/PythonQt.prf ) +CONFIG+=BUILDING_QTALL +include ( ../../build/pythonqt.prf ) +contains(QT_MAJOR_VERSION, 5) { + QT += widgets +} HEADERS += \ PyExampleDecorators.h diff --git a/examples/PyDecoratorsExample/PyExampleDecorators.h b/examples/PyDecoratorsExample/PyExampleDecorators.h --- a/examples/PyDecoratorsExample/PyExampleDecorators.h +++ b/examples/PyDecoratorsExample/PyExampleDecorators.h @@ -89,6 +89,13 @@ public slots: // add a method to your own CPP object int doSomething(YourCPPObject* obj, int arg1) { return obj->doSomething(arg1); } + + // add a docstring to your own CPP object + QString doc_YourCPPObject() {return "A C++ Class object";} + + // add a docstrint to YourCPPObject::doSomething + QString doc_YourCPPObject_doSomething() {return "this function does something";} + }; diff --git a/examples/PyDecoratorsExample/example.py b/examples/PyDecoratorsExample/example.py --- a/examples/PyDecoratorsExample/example.py +++ b/examples/PyDecoratorsExample/example.py @@ -24,5 +24,11 @@ print yourCpp.doSomething(3); # show slots available on yourCpp print dir(yourCpp) +# show docstring of yourCpp +print yourCpp.__doc__ + +# show docstring of yourCpp.doSomething +print yourCpp.doSomething.__doc__ + # destructor will be called: yourCpp = None diff --git a/examples/PyGettingStarted/PyGettingStarted.pro b/examples/PyGettingStarted/PyGettingStarted.pro --- a/examples/PyGettingStarted/PyGettingStarted.pro +++ b/examples/PyGettingStarted/PyGettingStarted.pro @@ -11,8 +11,13 @@ DESTDIR = ../../lib CONFIG += console +contains(QT_MAJOR_VERSION, 5) { + QT += widgets +} + include ( ../../build/common.prf ) -include ( ../../build/PythonQt.prf ) +CONFIG+=BUILDING_QTALL +include ( ../../build/pythonqt.prf ) SOURCES += \ main.cpp diff --git a/examples/PyGuiExample/PyGuiExample.pro b/examples/PyGuiExample/PyGuiExample.pro --- a/examples/PyGuiExample/PyGuiExample.pro +++ b/examples/PyGuiExample/PyGuiExample.pro @@ -11,8 +11,14 @@ mac:CONFIG -= app_bundle DESTDIR = ../../lib +contains(QT_MAJOR_VERSION, 5) { + QT += widgets +} + + include ( ../../build/common.prf ) -include ( ../../build/PythonQt.prf ) +CONFIG+=BUILDING_QTALL +include ( ../../build/pythonqt.prf ) include ( ../../build/PythonQt_QtAll.prf ) SOURCES += \ diff --git a/examples/PyLauncher/PyLauncher.pro b/examples/PyLauncher/PyLauncher.pro --- a/examples/PyLauncher/PyLauncher.pro +++ b/examples/PyLauncher/PyLauncher.pro @@ -11,8 +11,13 @@ mac:CONFIG -= app_bundle DESTDIR = ../../lib +contains(QT_MAJOR_VERSION, 5) { + QT += widgets +} + include ( ../../build/common.prf ) -include ( ../../build/PythonQt.prf ) +CONFIG+=BUILDING_QTALL +include ( ../../build/pythonqt.prf ) include ( ../../build/PythonQt_QtAll.prf ) SOURCES += \ diff --git a/examples/PyScriptingConsole/PyExampleObject.cpp b/examples/PyScriptingConsole/PyExampleObject.cpp --- a/examples/PyScriptingConsole/PyExampleObject.cpp +++ b/examples/PyScriptingConsole/PyExampleObject.cpp @@ -74,7 +74,7 @@ QMainWindow* PyExampleObject::createWind QObject* PyExampleObject::findChild(QObject* o, const QString& name) { - return qFindChild(o, name); + return o->findChild(name); } QVariantMap PyExampleObject::testMap() diff --git a/examples/PyScriptingConsole/PyScriptingConsole.pro b/examples/PyScriptingConsole/PyScriptingConsole.pro --- a/examples/PyScriptingConsole/PyScriptingConsole.pro +++ b/examples/PyScriptingConsole/PyScriptingConsole.pro @@ -9,11 +9,16 @@ TEMPLATE = app DESTDIR = ../../lib +contains(QT_MAJOR_VERSION, 5) { + QT += widgets +} + mac:CONFIG-= app_bundle include ( ../../build/common.prf ) -include ( ../../build/PythonQt.prf ) -include ( ../../build/PythonQt_QtAll.prf ) +CONFIG+=BUILDING_QTALL +include ( ../../build/pythonqt.prf ) +include ( ../../build/PythonQt_QtAll.prf ) HEADERS += \ PyExampleObject.h diff --git a/examples/examples.pro b/examples/examples.pro --- a/examples/examples.pro +++ b/examples/examples.pro @@ -6,4 +6,5 @@ SUBDIRS = CPPPyWrapperExample \ PyGuiExample \ PyDecoratorsExample \ PyScriptingConsole \ - PyLauncher + PyLauncher \ + NicePyConsole diff --git a/extensions/PythonQt_QtAll/PythonQt_QtAll.cpp b/extensions/PythonQt_QtAll/PythonQt_QtAll.cpp --- a/extensions/PythonQt_QtAll/PythonQt_QtAll.cpp +++ b/extensions/PythonQt_QtAll/PythonQt_QtAll.cpp @@ -61,7 +61,5 @@ namespace PythonQt_QtAll // Does not compile yet: // PythonQt_init_QtXmlPatterns(0); // PythonQt_init_QtPhonon(0); - }; -}; - - + } +} diff --git a/generator/generate.sh b/generator/generate.sh old mode 100644 new mode 100755 diff --git a/generator/merge.sh b/generator/merge.sh old mode 100644 new mode 100755 diff --git a/generator/parser/rpp/pp-iterator.h b/generator/parser/rpp/pp-iterator.h --- a/generator/parser/rpp/pp-iterator.h +++ b/generator/parser/rpp/pp-iterator.h @@ -71,6 +71,14 @@ public: explicit pp_output_iterator(std::string &__result): _M_result (__result) {} + // this copy constructor was needed for Visual Studio 2012 release builds: + inline pp_output_iterator &operator=(const pp_output_iterator& other) + { + *(std::iterator*)(this) = other; + _M_result = other._M_result; + return *this; + } + inline pp_output_iterator &operator=(typename _Container::const_reference __v) { if (_M_result.capacity () == _M_result.size ()) diff --git a/generator/typesystem_gui.xml b/generator/typesystem_gui.xml --- a/generator/typesystem_gui.xml +++ b/generator/typesystem_gui.xml @@ -4539,6 +4539,7 @@ PyObject* constScanLine(QImage* image, i + diff --git a/generator/typesystem_webkit.xml b/generator/typesystem_webkit.xml --- a/generator/typesystem_webkit.xml +++ b/generator/typesystem_webkit.xml @@ -46,6 +46,7 @@ + diff --git a/generator_50/generate.sh b/generator_50/generate.sh old mode 100644 new mode 100755 diff --git a/generator_50/typesystem_core-qtscript.xml b/generator_50/typesystem_core-qtscript.xml --- a/generator_50/typesystem_core-qtscript.xml +++ b/generator_50/typesystem_core-qtscript.xml @@ -377,7 +377,7 @@ - + diff --git a/generator_50/typesystem_opengl.xml b/generator_50/typesystem_opengl.xml --- a/generator_50/typesystem_opengl.xml +++ b/generator_50/typesystem_opengl.xml @@ -9,6 +9,11 @@ + + + + + @@ -27,6 +32,8 @@ + + diff --git a/scripts/osx-fix-dylib.sh b/scripts/osx-fix-dylib.sh new file mode 100755 --- /dev/null +++ b/scripts/osx-fix-dylib.sh @@ -0,0 +1,175 @@ +#!/bin/bash + +# +# file is included into the qmake systym in the common.prf file +# + + + + +# +# +# + +main() { + + + + verbose=0 + fix_release_lib=1 + fix_debug_lib=0 + + # parsing command line options + while getopts ":vh?dra" opt; do + case $opt in + h) + echo "Help for osx-file-dylib -[vh] + v : verbose output + d : fix debug libs + r : fix release libs (default) + a : fix all libs + " >&2 + exit + ;; + v) + echo "-v was triggered!" >&2 + verbose=1 # means it is on + ;; + d) + fix_debug_lib=1 # means it is on + ;; + r) + fix_release_lib=1 # means it is on + ;; + a) + fix_release_lib=1 + fix_debug_lib=1 + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + ;; + esac + done + + + + BASEPATH=`pwd` + + if [ $verbose == 1 ] ; then + echo "Basepath = " $BASEPATH + ls -l *.dylib + fi + + + # first the release files + if [ $fix_release_lib == 1 ] ; then + fixit libPythonQt.1.0.0.dylib libPythonQt_QtAll.1.0.0.dylib $verbose + fi + + # then the debug libs + if [ $fix_debug_lib == 1 ] ; then + fixit libPythonQt_d.1.0.0.dylib libPythonQt_QtAll_d.1.0.0.dylib $verbose + fi + + if [ $verbose ] ; then + #tput bold + echo $LIBPYTHONQT + #tput sgr0 + otool -L $LIBPYTHONQT + #install_name_tool -id $FULLLIBPYTHONQT $FULLLIBPYTHONQT + #otool -L $LIBPYTHONQT + + #tput bold + echo $LIBPYTHONQTALL + #tput sgr0 + otool -L $LIBPYTHONQTALL + #install_name_tool -id $FULLLIBPYTHONQTALL $FULLLIBPYTHONQTALL + + #install_name_tool -change libPythonQt.1.dylib $FULLLIBPYTHONQT $LIBPYTHONQTALL + + #otool -L $LIBPYTHONQTALL + fi +} + + + + + + + +function fixit { + # + # fixit(LIBPYTHONQT, LIBPYTHONQTALL, VERBOSE) + # + + + LIBPYTHONQT=$1 + LIBPYTHONQTALL=$2 + VERBOSE=$3 + + BASEPATH=`pwd` + FULLLIBPYTHONQT=$BASEPATH"/"$LIBPYTHONQT + FULLLIBPYTHONQTALL=$BASEPATH"/"$LIBPYTHONQTALL + + + if [ -e $LIBPYTHONQT ] + then + #tput bold + echo "fixing " $LIBPYTHONQT + #tput sgr0 + #otool -L $LIBPYTHONQT + install_name_tool -id $FULLLIBPYTHONQT $FULLLIBPYTHONQT + #otool -L $LIBPYTHONQT + else + #tput bold + echo "[Warning] " $LIBPYTHONQT " is missing here:" `pwd` + #tput sgr0 + fi + + + if [ -e $LIBPYTHONQTALL ] + then + #tput bold + echo "fixing " $LIBPYTHONQTALL + #tput sgr0 + #otool -L $LIBPYTHONQTALL + install_name_tool -id $FULLLIBPYTHONQTALL $FULLLIBPYTHONQTALL + + echo "libPython:" $LIBPYTHONQT + # if debug then + if [[ $LIBPYTHONQTALL == *_d.*dylib ]] + then + LIBPYTHONQT1=libPythonQt_d.1.dylib + else + LIBPYTHONQT1=libPythonQt.1.dylib + fi + + install_name_tool -change $LIBPYTHONQT1 $FULLLIBPYTHONQT $LIBPYTHONQTALL + + + #otool -L $LIBPYTHONQTALL + else + #tput bold + echo "[Warning] " $LIBPYTHONQTALL " is missing here:" `pwd` + #tput sgr0 + fi + + + +} + + + +# now we actually call main +main $@ + + + + + + + + + + + diff --git a/src/PythonQt.cpp b/src/PythonQt.cpp --- a/src/PythonQt.cpp +++ b/src/PythonQt.cpp @@ -546,6 +546,11 @@ PythonQtClassWrapper* PythonQtPrivate::c PyObject* typeDict = PyDict_New(); PyObject* moduleName = PyObject_GetAttrString(parentModule, "__name__"); PyDict_SetItemString(typeDict, "__module__", moduleName); + if (!info->doc().isNull()) { + PyObject* docStr = PythonQtConv::QStringToPyObject(info->doc()); + PyDict_SetItemString(typeDict, "__doc__", docStr); + Py_DECREF(docStr); + } PyObject* args = Py_BuildValue("OOO", className, baseClasses, typeDict); @@ -1283,6 +1288,28 @@ void PythonQtPrivate::addDecorators(QObj PythonQtClassInfo* classInfo = lookupClassInfoAndCreateIfNotPresent(nameOfClass); PythonQtSlotInfo* newSlot = new PythonQtSlotInfo(NULL, m, i, o, PythonQtSlotInfo::ClassDecorator); classInfo->addDecoratorSlot(newSlot); + } else if (signature.startsWith("doc_")) { + if ((decoTypes & DocstringDecorator) == 0) continue; + QByteArray nameOfClassAndMethod = signature.mid(4, signature.indexOf('(')-4); + QList nameOfClassAndMethodAsList = nameOfClassAndMethod.split('_'); + QByteArray nameOfClass = nameOfClassAndMethodAsList.at(0); + PythonQtClassInfo* classInfo = lookupClassInfoAndCreateIfNotPresent(nameOfClass); + // TODO: make shure that the function does not take arguments and returns a QString + QString docString; + void* argList[1] = {&docString}; + o->qt_metacall(QMetaObject::InvokeMetaMethod, i, argList); + if( nameOfClassAndMethodAsList.size() == 1 ) { + // __doc__ of class itself + classInfo->setDoc(docString); + } else { + // __doc__ of class method (e.g. public slot) + QByteArray nameOfMethod = nameOfClassAndMethodAsList.at(1); + PythonQtMemberInfo member = classInfo->member(nameOfMethod); + // check if we really found a slot + if( member._type == PythonQtMemberInfo::Slot || member._type == PythonQtMemberInfo::Signal ) { + member._slot->setDoc(docString); + } + } } else { if ((decoTypes & InstanceDecorator) == 0) continue; const PythonQtMethodInfo* info = PythonQtMethodInfo::getCachedMethodInfo(m, NULL); diff --git a/src/PythonQt.h b/src/PythonQt.h --- a/src/PythonQt.h +++ b/src/PythonQt.h @@ -569,6 +569,7 @@ public: ConstructorDecorator = 2, DestructorDecorator = 4, InstanceDecorator = 8, + DocstringDecorator = 16, AllDecorators = 0xffff }; diff --git a/src/PythonQtClassInfo.cpp b/src/PythonQtClassInfo.cpp --- a/src/PythonQtClassInfo.cpp +++ b/src/PythonQtClassInfo.cpp @@ -602,6 +602,9 @@ QString PythonQtClassInfo::help() decorator(); QString h; h += QString("--- ") + QString(className()) + QString(" ---\n"); + + if (!_doc.isNull()) + h += "Description:\n" + _doc + "\n"; if (_isQObject) { h += "Properties:\n"; diff --git a/src/PythonQtClassInfo.h b/src/PythonQtClassInfo.h --- a/src/PythonQtClassInfo.h +++ b/src/PythonQtClassInfo.h @@ -187,6 +187,12 @@ public: //! clear all members that where cached as "NotFound" void clearNotFoundCachedMembers(); + //! set the python docstring (__doc__) for this class + void setDoc(const QString& str) {_doc=str;} + + //! get the python docstring (__doc__) for this class + const QString& doc() const {return _doc;} + private: void createEnumWrappers(); void createEnumWrappers(const QMetaObject* meta); @@ -238,6 +244,8 @@ private: bool _isQObject; bool _enumsCreated; + + QString _doc; }; diff --git a/src/PythonQtClassWrapper.cpp b/src/PythonQtClassWrapper.cpp --- a/src/PythonQtClassWrapper.cpp +++ b/src/PythonQtClassWrapper.cpp @@ -181,13 +181,13 @@ static void initializeSlots(PythonQtClas } if (typeSlots & PythonQt::Type_InplaceAdd) { - wrap->_base.as_number.nb_add = (binaryfunc)PythonQtInstanceWrapper_iadd; + wrap->_base.as_number.nb_inplace_add = (binaryfunc)PythonQtInstanceWrapper_iadd; } if (typeSlots & PythonQt::Type_InplaceSubtract) { - wrap->_base.as_number.nb_subtract = (binaryfunc)PythonQtInstanceWrapper_isub; + wrap->_base.as_number.nb_inplace_subtract = (binaryfunc)PythonQtInstanceWrapper_isub; } if (typeSlots & PythonQt::Type_InplaceMultiply) { - wrap->_base.as_number.nb_multiply = (binaryfunc)PythonQtInstanceWrapper_imul; + wrap->_base.as_number.nb_inplace_multiply = (binaryfunc)PythonQtInstanceWrapper_imul; } if (typeSlots & PythonQt::Type_InplaceDivide) { #ifndef PY3K diff --git a/src/PythonQtMethodInfo.h b/src/PythonQtMethodInfo.h --- a/src/PythonQtMethodInfo.h +++ b/src/PythonQtMethodInfo.h @@ -101,6 +101,12 @@ public: //! add an alias for a typename, e.g. QObjectList and QList. static void addParameterTypeAlias(const QByteArray& alias, const QByteArray& name); + //! set the docstirng + void setDoc(const QString& str) {_doc = str;} + + //! get the docstring + const QString& doc() const {return _doc; } + protected: static void fillParameterInfo(ParameterInfo& type, const QByteArray& name, PythonQtClassInfo* classInfo); @@ -111,6 +117,9 @@ public: static QHash _cachedSignatures; QList _parameters; + + //! stores the docstring + QString _doc; }; //! stores information about a slot, including a next pointer to overloaded slots diff --git a/src/PythonQtSlot.cpp b/src/PythonQtSlot.cpp --- a/src/PythonQtSlot.cpp +++ b/src/PythonQtSlot.cpp @@ -413,8 +413,10 @@ meth_dealloc(PythonQtSlotFunctionObject } static PyObject * -meth_get__doc__(PythonQtSlotFunctionObject * /*m*/, void * /*closure*/) +meth_get__doc__(PythonQtSlotFunctionObject *m, void * /*closure*/) { + if( !m->m_ml->doc().isEmpty() ) + return PythonQtConv::QStringToPyObject(m->m_ml->doc()); Py_INCREF(Py_None); return Py_None; } diff --git a/src/src.pro b/src/src.pro --- a/src/src.pro +++ b/src/src.pro @@ -10,9 +10,18 @@ TEMPLATE = lib DESTDIR = ../lib -CONFIG += qt dll +CONFIG += qt CONFIG -= flat + +# allow to choose static linking through the environment variable PYTHONQT_STATIC +PYTHONQT_STATIC = $$(PYTHONQT_STATIC) +isEmpty(PYTHONQT_STATIC) { + CONFIG += dll +} else { + CONFIG += static +} + contains(QT_MAJOR_VERSION, 5) { QT += widgets } @@ -25,28 +34,3 @@ include ( ../build/common.prf ) include ( ../build/python.prf ) include ( src.pri ) -#added by Aje for install QT dirs. -#Copyed from Qscintilla config ;). - - -pythoncfg.path = $$[QT_INSTALL_PREFIX]/mkspecs/features -pythoncfg.files = ../build/pythonqt.prf - -target.path = $$[QT_INSTALL_LIBS] -isEmpty(target.path) { - target.path = $(QTDIR)/lib -} - -header.path = $$[QT_INSTALL_HEADERS]/PythonQt -header.files = *.h -isEmpty(header.path) { - header.path = $(QTDIR)/include/PythonQt - header.files = *.h -} -guiheader.path = $$[QT_INSTALL_HEADERS]/PythonQt/gui -guiheader.files = gui/*.h -isEmpty(guiheader.path) { - guiheader.path = $(QTDIR)/include/PythonQt/gui - guiheader.files = gui/*.h -} -INSTALLS += header target guiheader pythoncfg diff --git a/tests/PythonQtTests.cpp b/tests/PythonQtTests.cpp --- a/tests/PythonQtTests.cpp +++ b/tests/PythonQtTests.cpp @@ -269,19 +269,19 @@ void PythonQtTestSlotCalling::testCppFac } -PQCppObject2Decorator::TestEnumFlag PQCppObject2Decorator::testEnumFlag1(PQCppObject2* obj, PQCppObject2Decorator::TestEnumFlag flag) { +PQCppObject2Decorator::TestEnumFlag PQCppObject2Decorator::testEnumFlag1(PQCppObject2* /*obj*/, PQCppObject2Decorator::TestEnumFlag flag) { return flag; } -PQCppObject2::TestEnumFlag PQCppObject2Decorator::testEnumFlag2(PQCppObject2* obj, PQCppObject2::TestEnumFlag flag) { +PQCppObject2::TestEnumFlag PQCppObject2Decorator::testEnumFlag2(PQCppObject2* /*obj*/, PQCppObject2::TestEnumFlag flag) { return flag; } // with int overload -PQCppObject2Decorator::TestEnumFlag PQCppObject2Decorator::testEnumFlag3(PQCppObject2* obj, int flag) { +PQCppObject2Decorator::TestEnumFlag PQCppObject2Decorator::testEnumFlag3(PQCppObject2* /*obj*/, int /*flag*/) { return (TestEnumFlag)-1; } -PQCppObject2Decorator::TestEnumFlag PQCppObject2Decorator::testEnumFlag3(PQCppObject2* obj, PQCppObject2Decorator::TestEnumFlag flag) { +PQCppObject2Decorator::TestEnumFlag PQCppObject2Decorator::testEnumFlag3(PQCppObject2* /*obj*/, PQCppObject2Decorator::TestEnumFlag flag) { return flag; } @@ -538,25 +538,25 @@ void PythonQtTestApi::testQColorDecorato QVERIFY(colorClass.call("red", QVariantList() << QColor(255,0,0)).toInt() == 255); } -QByteArray PythonQtTestApiHelper::readFileAsBytes(const QString& filename) +QByteArray PythonQtTestApiHelper::readFileAsBytes(const QString& /*filename*/) { QByteArray b; return b; } -QByteArray PythonQtTestApiHelper::readSourceFile(const QString& filename, bool& ok) +QByteArray PythonQtTestApiHelper::readSourceFile(const QString& /*filename*/, bool& ok) { QByteArray b; ok = true; return b; } -bool PythonQtTestApiHelper::exists(const QString& filename) +bool PythonQtTestApiHelper::exists(const QString& /*filename*/) { return true; } -QDateTime PythonQtTestApiHelper::lastModifiedDate(const QString& filename) { +QDateTime PythonQtTestApiHelper::lastModifiedDate(const QString& /*filename*/) { return QDateTime::currentDateTime(); } diff --git a/tests/PythonQtTests.h b/tests/PythonQtTests.h --- a/tests/PythonQtTests.h +++ b/tests/PythonQtTests.h @@ -240,10 +240,10 @@ public slots: PQCppObjectNoWrap* new_PQCppObjectNoWrap() { return new PQCppObjectNoWrap(0); } - PQCppObjectNoWrap* new_PQCppObjectNoWrap(const PQCppObjectNoWrap& other) { + PQCppObjectNoWrap* new_PQCppObjectNoWrap(const PQCppObjectNoWrap& /*other*/) { return new PQCppObjectNoWrap(1); } - PQCppObjectNoWrap* new_PQCppObjectNoWrap(double value) { + PQCppObjectNoWrap* new_PQCppObjectNoWrap(double /*value*/) { return new PQCppObjectNoWrap(2); } @@ -352,13 +352,13 @@ public slots: void testNoArg() { _called = true; } //! overload test! - void overload(bool a) { _calledOverload = 0; _called = true; } - void overload(float a) { _calledOverload = 1; _called = true;} - void overload(int a) { _calledOverload = 2; _called = true;} - void overload(const QString& str) { _calledOverload = 3; _called = true;} - void overload(const QStringList& str) { _calledOverload = 4; _called = true;} - void overload(QObject* str) { _calledOverload = 5; _called = true;} - void overload(float a, int b) { _calledOverload = 6; _called = true;} + void overload(bool) { _calledOverload = 0; _called = true; } + void overload(float) { _calledOverload = 1; _called = true;} + void overload(int) { _calledOverload = 2; _called = true;} + void overload(const QString&) { _calledOverload = 3; _called = true;} + void overload(const QStringList&) { _calledOverload = 4; _called = true;} + void overload(QObject*) { _calledOverload = 5; _called = true;} + void overload(float, int) { _calledOverload = 6; _called = true;} //! POD values: int getInt(int a) { _called = true; return a; } diff --git a/tests/tests.pro b/tests/tests.pro --- a/tests/tests.pro +++ b/tests/tests.pro @@ -5,19 +5,35 @@ # -------------------------------------------------- TARGET = PythonQtTest TEMPLATE = app +DESTDIR = ../lib + +mac { + CONFIG -= app_bundle +} + +QT += testlib + +include ( ../build/common.prf ) +CONFIG+=BUILDING_QTALL +include ( ../build/pythonqt.prf ) contains(QT_MAJOR_VERSION, 5) { - QT += testlib widgets -} else { - CONFIG += qtestlib + QT += widgets } -include ( ../build/common.prf ) -include ( ../build/PythonQt.prf ) - HEADERS += \ PythonQtTests.h SOURCES += \ PythonQtTestMain.cpp \ PythonQtTests.cpp + +# run the tests after compiling +macx { + QMAKE_POST_LINK = cd $${DESTDIR} && ./$${TARGET} +} else:win32 { + QMAKE_POST_LINK = \"$${DESTDIR}/$${TARGET}.exe\" +} else:unix { + # linux + QMAKE_POST_LINK = cd $${DESTDIR} && LD_LIBRARY_PATH=$$(LD_LIBRARY_PATH):./ xvfb-run -a ./$${TARGET} +}