aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/libpyside
Commit message (Collapse)AuthorAgeFilesLines
* libpyside: Refactor MetaObjectBuilderPrivate::parsePythonType()Friedemann Kleint2018-11-291-33/+26
| | | | | | | | | | | | | | - Use std::vector to collect the base types. Append the type first to avoid reshuffling when prepending. - Add properties immediately instead of storing in the 2nd loop as signals are already added. - Clang tidy: Use range based for, auto, nullptr Task-number: PYSIDE-784 Change-Id: I765beb2d09600e78abd314cbb394cd106ec22f03 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Install snippets glue codeCristian Maureira-Fredes2018-11-282-0/+2
| | | | | | | | | | | | | The module-specific glue files as well as the standalone glue files are now installed into the PySide2 package. The glue files are now also listed as dependencies for the shiboken generator run, which means that modifying those files will now correctly force a shiboken re-run for the relevant modules. Change-Id: I545c7ada379fafb7f225d0b0f5ce495bf6d4795d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Friedemann Kleint2018-10-296-8/+8
|\ | | | | | | Change-Id: I3bb491686968e81382c135ab737da259d9796f52
| * Fix Memory Leak Caused By Wrong Limited API DefaultChristian Tismer2018-10-296-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a type has nullptr as tp_dealloc, there apply different defaults. Static types had object_dealloc as default, while new heaptypes created with type_new have subtype_dealloc as default. A problem was now that PyType_FromSpec also has subtype_dealloc as default. But that is wrong, because a type that was written with the static type approach is already written with object_dealloc in mind and takes somehow care about further issues with that type. When we now convert this type and suddenly use subtype_dealloc instead of object_dealloc, things get pretty wrong. Finding that out was pretty hard and took quite long to understand. The fix was then very easy and is the best proof: Replacing our former (wrong) solution of supplying an SbkDummyDealloc with a function object_dealloc works perfectly, and the leakage completely vanished. The documentation now is also corrected. Task-number: PYSIDE-832 Change-Id: Ifc20c28172eb5663cd5e60dac52e0a43acfb626c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | libpyside: Port DynamicQMetaObject to QMetaObjectBuilderFriedemann Kleint2018-10-229-693/+337
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qt 5 introduces a new class QMetaObjectBuilder for generating dynamic meta objects for use cases like QML. It provides an API to add methods, properties and info and a factory method toMetaObject() to obtain a QMetaObject snapshot reflecting the changes. Replace the DynamicQMetaObject aggregated by TypeUserData by a class MetaObjectBuilder wrapping a QMetaObjectBuilder with dirty-handling. The code to create the binary data of the QMetaObject can then be removed. For plain Qt objects, the wrapped base meta object will be returned (which fixes the bug). Task-number: PYSIDE-784 Change-Id: Id8a54570aff36c75fe0f3bf2d297a12d02cd773a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | libpyside: Introduce helper functions for accessing TypeUserData and meta ↵Friedemann Kleint2018-10-164-22/+54
| | | | | | | | | | | | | | | | | | | | | | | | objects Add helpers with overloads to reduce reinterpret_cast<> and increase type safety. Task-number: PYSIDE-784 Change-Id: I334fd7d149a6730094b062dd0371b9a29379d725 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | libpyside: Fix warning about QMetaObject being forward-declared as classFriedemann Kleint2018-10-021-2/+4
| | | | | | | | | | | | | | | | | | It is in fact a struct. Amends 7127a16f53fdadc709d234abf83d7fadfdf3aba7. Fixes: warning: class 'QMetaObject' was previously declared as a struct [-Wmismatched-tags] Change-Id: I3ed3d17706123f3649ac6e889080c5ab095f7e07 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | libpyside: Replace foreach by range-based forFriedemann Kleint2018-10-023-4/+4
| | | | | | | | | | Change-Id: I577ca66e0bd92cfedd060b46f4946963eb91f991 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | libpyside: Clean up #include directivesFriedemann Kleint2018-10-0222-82/+84
| | | | | | | | | | | | | | | | | | | | Remove unused #include directives, group by libpyside, libshiboken, Qt, C++ and sort alphabetically with the exception of sbkpython.h which sanitizes the "slot" defines and needs to go to the top when used). Add the module to the Qt classes. Change-Id: I33d912135bad928d3073a1ddeb487de237d6a45e Reviewed-by: Christian Tismer <tismer@stackless.com>
* | libpyside: Remove deprecated GlobalReceiverFriedemann Kleint2018-10-015-459/+0
| | | | | | | | | | Change-Id: Ied37d22fbd8277811aaea15af0018cec545814c7 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | libpyside: Fix reinterpret_casts related to DynamicQMetaObjectFriedemann Kleint2018-09-284-14/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, DynamicQMetaObject instances were retrieved by direct reinterpret_cast from the SBK user data. This is not entirely correct since the DynamicQMetaObject is merely the first member of the struct TypeUserData. Fix this by moving the struct TypeUserData to a private header and correcting the casts. Task-number: PYSIDE-784 Change-Id: I69ea68bd474c4a38a5f5c5bc3db8bc3bb086e012 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | libpyside: Replace configuration of signalmanager.cpp by definesFriedemann Kleint2018-09-272-7/+5
| | | | | | | | | | | | | | | | | | This makes the development process easier. Task-number: PYSIDE-784 Change-Id: I07ced4b25b65c90e5a17d85be9b8f15a26e5d07d Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | libpyside: Fix contains()/value() antipatternFriedemann Kleint2018-09-123-13/+18
| | | | | | | | | | | | | | | | Use iterators instead, avoiding repeated lookups of hashes and maps. Change-Id: I3b430bdf0ceef1980baeca45849880d35538e89b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* | libpyside: Fix deprecation warningFriedemann Kleint2018-09-121-1/+1
| | | | | | | | | | | | | | | | Expand code to fix: signalmanager.cpp:328:41: warning: 'int PySide::SignalManager::addGlobalSlotGetIndex(const char*, PyObject*)' is deprecated [-Wdeprecated-declarations] Change-Id: I5ada505b8ed9a8bd7e604633bc672109450ede6f Reviewed-by: Christian Tismer <tismer@stackless.com>
* | libpyside: Change assert into a warningFriedemann Kleint2018-09-101-1/+5
| | | | | | | | | | | | | | | | | | Emit a warning instead of asserting in SignalManager::registerMetaMethodGetIndex() when source=0. Task-number: PYSIDE-800 Change-Id: Ic3c67d39ddb3d1c1f808d6434f37fbdd74868b5b Reviewed-by: Christian Tismer <tismer@stackless.com>
* | libpyside/PyObjectWrapper: Fix clang-tidy warnings about class definitionFriedemann Kleint2018-09-052-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Rearrange definition and delete move constructor and move assignment operator. This unearthed that the (default-generated) move assignment operator was used (unintendedly) in: QDataStream &operator>>(QDataStream&,PyObjectWrapper&). Factor out a reset() method (modeled after std::unique_ptr, QScopedPointer) for this. Change-Id: I48c4f9ca1353984da870bb7eb3308a9f3374d309 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | libpyside: Replace QLinkedList<QObject*> by QVector<QObject*> in DynamicSlotDataFriedemann Kleint2018-09-041-4/+4
| | | | | | | | | | | | Change-Id: Id7b8c7ee48a3e0017d4c66fba34dff573fc59008 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* | libpyside: Replace QLinkedList<QByteArray> by QByteArrayList in MetaObjectFriedemann Kleint2018-09-041-44/+27
| | | | | | | | | | | | | | | | Remove unused list parameter from DynamicQMetaObject::createMetaData(), adapt signatures, make const where applicable and streamline code. Change-Id: I0733382b2a6a35579d3e69280d674ad8a8f1bbc6 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.11' into devFriedemann Kleint2018-09-041-0/+2
|\| | | | | | | Change-Id: Ie8025300580981c5349b31d4846a7f659481991d
| * PySide2: Fix compilation with a with custom namespace specified for QtFriedemann Kleint2018-08-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | Add missing QT_BEGIN/END_NAMESPACE macros. Patch as provided on bug report. Task-number: PYSIDE-635 Change-Id: I7ddb447f1aafeb8da72e7e192905bafe3809797d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* | libshiboken: Replace AutoDecRef::operator= by a reset() methodFriedemann Kleint2018-08-311-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The operators cause compiler warnings about multiple versions and missing return types. Replace them by a reset() method (modeled after std::unique_ptr, QScopedPointer). This implies some changes in the templates. Change-Id: I21a8fb9b84ecdfecf9671fa113f1bb3c6483166f Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | libpyside: Fix clang-tidy warnings about class definitionsFriedemann Kleint2018-08-3110-34/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add override - Use = default for trivial constructors/destructors - Add Q_DISABLE_COPY where applicable - Use member initialization and remove constructors from simple structs - Use explicit where applicable (which requires adapting code snippets constructing a QVariant from PyObjectWrapper) - Fix some parameter to take a const ref or pass by value and use std::move in constructors Change-Id: I5e0d2c4ef92d20397a7daba2f8a64b507e678510 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | libpyside: Fix remaining clang-tidy warningsFriedemann Kleint2018-08-309-52/+48
| | | | | | | | | | | | | | | | | | | | | | - Remove else after return/continue/break; unindent code or simplify return conditions - Use isEmpty() to check for empty containers - Fix C-style casts - Pass std::size_t by value instead of const ref Change-Id: Ic997d7c39720c1cd3698c4d750e9cfc1f1654788 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | libpyside: Fix spelling of retrive->retrieveFriedemann Kleint2018-08-243-4/+4
| | | | | | | | | | | | | | Rename method and fix comments. Change-Id: I7765826540de0bf03ac41214d357e605d8e84bcf Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.11' into devFriedemann Kleint2018-08-241-2/+0
|\| | | | | | | Change-Id: Ide71a89ef173d6f3e1fa6960f7b15f1fd6cc1bf1
| * Implement Proper Name ManglingChristian Tismer2018-08-211-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When types have attributes starting with two underscores but ending with at most one, Python uses name mangling to create a unique private variable. PySide needs to obey this rule in the tp_getattro methods. We implemented it as an optimized _Pep_PrivateMangle function that solves the problem internally without exposing the _Py_Mangle function. Remark: I think the exclusion of the _Py_Mangle function is another oversight in the Limited API. Task-number: PYSIDE-772 Change-Id: I0bfc2418dae439e963a16e37443f2099c6980696 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Limited API: remove the "slot_" workaroundChristian Tismer2018-08-231-7/+2
|/ | | | | | | | | | | | It has been a problem to compile the file "typespec.*" when using Python 2. For some reason, the name "slot" was not usable. I cannot find out what it was and how it vanished, but now I could remove the work-around without problems. Maybe it is due to some different includes which don't define some macros? Change-Id: If316c9c78a18cffcc5e4cac07610bd7f522db446 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Pep 384 Final Cut: Remove PepTypeChristian Tismer2018-07-237-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | While trying to document the Limited API Project, it suddenly struck me: We can make the patch much much simpler and implement it without the necessity to have an extra PepType! Now I am happy to continue the documentation, because it is now no more improvable. This version will last as long as the layout of PyTypeObject does not change substantially. When that happens, then we need to rewrite stuff with the according PyType_GetSlot() access functions. These access functions will until then be complete enough so that we can live without the tricks like inventing a reduced PyTypeObject as was done in the current implementation. Task-number: PYSIDE-560 Change-Id: I49849cc377baa6794a5b53292691e21d6e2853ab Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Generate fully Qualified Names for FlagsChristian Tismer2018-07-161-2/+2
| | | | | | | | | The flags structure should give correct full names. See the doc in the issue tracker. Task-number: PYSIDE-747 Change-Id: I6b5c602566d3e4b8a2a93e2522e92da956578b18 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Remove QT_LOGGING_RULES to fix QLibraryPath pathsCristian Maureira-Fredes2018-06-212-19/+0
| | | | | | | | | | | | | QT_LOGGING_RULES was internally overwriting the PySide2 QLibraryPath configuration, so all the paths were incorrect. Please follow PYSIDE-717 for a discussion on an alternative to have a proper solution. Task-number: PYSIDE-694 Change-Id: I551d7876a416ac31fcff70d843a28c98dfa5ed08 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* PEP 384-squash: Implement PEP 384Christian Tismer2018-05-3018-485/+327
| | | | | | | | | | This is the condensed checkin of 18 commits which created the implementation of PEP 384. Task-number: PYSIDE-560 Change-Id: I834c659af4c2b55b268f8e8dc4cfa53f02502409 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Change license from all the filesCristian Maureira-Fredes2018-05-0332-32/+32
| | | | | | | | | | | | | | | | | Removing the word 'project' from all the headers, and changing the PySide reference from the examples to Qt for Python: The following line was used inside the source/ and build_scripts/ directory: for i in $(grep -r "the Qt for Python project" * |grep -v "pyside2-tools" | awk '{print $1}' | sed 's/:.*//g');do sed -i 's/the\ Qt\ for\ Python\ project/Qt\ for\ Python/g' $i;done and the following line was used inside the examples/ directory: for i in $(grep -r "of the PySide" * |grep -v "pyside2-tools" | awk '{print $1}' | sed 's/:.*//g');do sed -i 's/of\ the\ PySide/of\ the\ Qt\ for\ Python/g' $i;done Change-Id: Ic480714686ad62ac4d81c670f87f1c2033d4ffa1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Rename PySide references to Qt for PythonCristian Maureira-Fredes2018-04-2732-32/+32
| | | | | | | | | When referring to the project one should use "Qt for Python" and for the module "PySide2" Change-Id: I36497df245c9f6dd60d6e160e2fc805e48cefcae Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Improve qt.conf registration handlingAlexandru Croitor2018-04-202-1/+43
| | | | | | | | | | | | | | | | | | | | | | When PyInstaller is used to deploy a PySide2 application, it changes the layout of the copied PySide2 files (no Qt subfolder, all shared libraries are copied next to tehe generated executable). In that case using the internal qt.conf won't work. Detect if there a exists a qt.conf file next to the executable, and use that file instead. Note that this won't work when the executable path has unicode characters in conjunction with Python 2 and Windows, but that is an unsupported config anyway (due to the mixing MSVC issue). Also add a logging category to ease figuring out which qt.conf file is used if a need ever arises to do so. Task-number: PYSIDE-642 Change-Id: I1260cbc13e5e62be72c4ed9c64c2aa5905d2e9c6 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix QtWebEngineProcess related issues on the supported platformsAlexandru Croitor2018-04-201-1/+8
| | | | | | | | | | | | | | | | | | There were 2 issues: 1) QtWebEngineProcess could not be found on Windows because we have a non-standard directory layout for the Qt files we copy over (there is no bin directory), so we need to adjust the internal qt.conf which is set in pyside.cpp 2) QtWebEngineProcess itself does not use the qt.conf from pyside.cpp, because it is a separate executable, and thus we need to supply a qt.conf specifically for it which is placed in the libexec folder. Task-number: PYSIDE-626 Task-number: PYSIDE-631 Task-number: PYSIDE-642 Change-Id: I75d1b083fb5afe5dc31ba90174f42c7f559c5cd5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* fix more qApp crashesChristian Tismer2018-04-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | When building PySide with a debug Python, a lot more problems become visible. They were triggered by some malicious ordering of the shutdown code, which must come *after* the refcounts of the variables are adjusted. The initial issue PYSIDE-585 was caused because the shutdown code is not only used for every created Q*Application, but also for the module shutdown, which deletes qApp_contents too often. Instead of special-casing that or adding some refcount, it was much more intuitive in that context to set qApp_content's refcount to the same value as Py_None, which also is not supposed to be garbage collected. Btw., the reason for the error message is that Py_None has it, too. When we set qApp_content's type to Py_None's type, it inherits the protection code that prevents someone from garbage collecting Py_None. Task-number: PYSIDE-585 Change-Id: I4af9de1192730f06054a5aca099a32e2392e367d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use XINCREF/XDECREF in PyObjectWrapper constructorCristian Maureira-Fredes2018-04-191-6/+6
| | | | | | | | | | | | When emitting a None signal the PyObjectWrapper constructors in the signalmanager were not working properly, but using the safe macros to increase and decrease the references of the object solves the issue. Task-number: PYSIDE-17 Change-Id: I1871e5b8227d6ddc893afce2ab9b311b60649024 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Check slot-signal association when connectingCristian Maureira-Fredes2018-03-021-3/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When connecting a signal with a slot there is a process to associate the proper signal signature, but the slot signature was not verified. This missing verification step lead to wrongly associate the slots and the signal signatures, for example: def on_clicked(checked=True): ... QGroupBox.clicked.connect(on_clicked) will wrongly connect the slot "on_clicked" with the signal "clicked()" (without any argument), when the proper signal is "clicked(bool)". This can be solved by manually specifying the arguments: QGroupBox.clicked[bool].connect(self.clicked) We can add an additional verification step to associate the proper signal if the slot has a certain number of arguments. There is an existing test that checks the compatibility of this change with all the ways to connect signals and slots. A few additional cases were added. Task-number: PYSIDE-104 Change-Id: Ic5b06fa3bb91903f7d506e0e2c52a6f7d3dc4570 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2018-02-231-1/+1
|\ | | | | | | Change-Id: I5d1a4734e8f44785898ba62beaa0bdd2004fca22
| * Don't copy duplicate libraries on package installationAlexandru Croitor2018-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change makes sure to resolve symlinks and copy only one file for every dynamic shared library used (vs 3 before -> 2 symlinks + 1 actual library). This avoids duplicate files, as well as saves space when creating wheel (e.g. no 3 copies of standalone WebEngine library). This filtering happens copying from CMake install dir into pyside_package_dir (the symlinks are still present in the CMake dir, but that shouldn't harm anybody, and might be useful for users of shiboken only for example). Task-number: PYSIDE-495 Change-Id: I0fe454e16c6b254a8682aa7b1c702ec01a3064f0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Fix usage of PyCFunction_GET_FLAGS in pysidesignal.cppAlexandru Croitor2018-02-141-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using PyCFunction_GET_FLAGS is unsafe, because it does not check whether the argument given is actually a PyCFunction object. This macro needs to be replaced with the function equivalent PyCFunction_GetFlags for stable ABI patch, but this will cause a crash in PyCFunction_Call because we don't check the return value of PyCFunction_GetFlags to see if it fails. Rather than checking the return value, it is safe to preemptively add a PyCFunction_Check before calling the GetFlags function. This does not modify the logic behind signalCall function. The crashing test was homonymoussignalandmethod_test.py, so no new test is needed. Task-number: PYSIDE-593 Change-Id: Id9ac9c0dec454e8e1ce9516dc68af924372a34a9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Fix error with second Qt.UniqueConnection callCristian Maureira-Fredes2018-02-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation was considering only Py_True as a success, but not Py_False. The else statement will enter just in case of error, as intended. Added a test case to verify the proper behavior of Qt.UniqueConnection. Task-number: PYSIDE-34 Change-Id: I5bafe0e81383022dcd7fc6251fc61d0ab5e918d0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Remove examples submoduleFriedemann Kleint2018-01-251-4/+1
|/ | | | | Change-Id: I0e4e3472e1d5644db281fb46ce4ba4ddfc1eafae Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* libpyside: Fix code forwarding Python exceptions to JSFriedemann Kleint2017-11-301-14/+4
| | | | | Change-Id: I6dffab506814e1d33812ed23b3e3920882b6c4e6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make standalone installations relocatableAlexandru Croitor2017-11-153-1/+149
| | | | | | | | | | | | | | | | | | This is achieved by registering a qt.conf file with a Prefix pointing to a directory relative to the loaded PySide2 module (e.g. QtCore). Thus Qt does not crash due to not finding platform plugins. Because this change would affect tests, which are ran before the PySide package is installed, a new environment variable called PYSIDE_DISABLE_INTERNAL_QT_CONF is introduced. This variable disables the registration of the internal qt.conf file, thus it will not point to a not yet created location, which will allow tests to run as before. Change-Id: I5a96037adfafe1f08ea57535aa4a2a0d1660dfaf Task-number: PYSIDE-558 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Remove dead / unused code regarding conversionsAlexandru Croitor2017-11-026-306/+5
| | | | | | | | | | | | | | | | | | | | | There's a lot of code that was previously used for doing conversions between C++ / Python types (apparently relying on extensive RTTI / typeid manipulations), which got superseded by a cleaner templated approach. The old code was left behind, and there were a few instances where it was still used even though it wasn't needed, like in QtScript typesystem XML and shiboken's enum handling. Remove the old code, apply the small changes needed to make it work with new the code. This is cleanup to reduce the confusion regarding conversion behavior, and also preparation for a proper implementation of handling "void*" types. Change-Id: I8f16bb31436f9a677bb2d64c7197c4375005b656 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Support the qApp macro correctly, final version incl. debugChristian Tismer2017-10-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For short the new features: - there is a qApp in QtCore, QtGui and QtWidgets for compatibility, and also in __builtins__ for a true macro-like experience. - if you delete any qApp variable, the Q*Application is reset and you can start over. Long description: There is a qApp macro in Qt5 which is equivalent to Q*Application.instance() . Python does not have macros. Both PyQt5 and PySide2 have an according structure in QtWidgets. In the case of PySide2, the qApp variable is first initialized to None and later to QApplication(). This does not reflect the original sense of the qApp macro, because - it only handles QApplication, - it does not handle destruction. This "macro" should live in QtCore, but both PyQt5 and PySide2 decided to put this in QtWidgets. As a compromize, I propose to put qApp into all three modules, and into __builtins__ as well, so wherever you create an application, you find this "macro" in place. While changing the code, I stumbled over the template set_qapp_parent_for_orphan. I tried to make sense out of it and finally removed it. There were no side effects but bug PYSIDE-85 is gone, now. With some extra effort, I created a singleton qApp that changes itself. This way, a true macro was simulated. Note that this was not possible with a garbage collected variable, and I had to make shiboken aware of this. As the final optimization, I turned qApp also into a fuse variable: Delete any qApp variable and Q*Application will finish when there is no extra reference. Task-number: PYSIDE-85 Task-number: PYSIDE-571 Change-Id: I7a56b19858f63349c98b95778759a6a6de856938 Reviewed-by: Christian Tismer <tismer@stackless.com>
* consistently name site-packages in Shiboken and PySideChristian Tismer2017-08-242-2/+2
| | | | | | | | | | | | The variable used for the python site-packages is inconsistent. Instead of "SITE_PACKAGE", we use "PYTHON_SITE_PACKAGES" everywhere. Task-number: PYSIDE-563 Change-Id: I4d2d49f20f5a0a13439bc7b8c79ab318cd831cb9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Julien Schueller <schueller@phimeca.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Improve suffix names for shared libraries and cmake config filesAlexandru Croitor2017-07-124-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | This change decouples the naming of general shared libraries, python module extensions, and cmake configuration files. All of them are now computed depending on the python version and python build configuration, and can also be manually set via CMake variables. The module extensions names now use the most detailed 'import' prefix, which usually informs whether a debug or release python was used, or the Python ABI flags (for Python >= 3.2). When a debug Python interpreter is used for building PySide2, the preprocessor define Py_Debug is now correctly propagated to PySide2 sources, which fixes previous crashes in debug builds. This affects only Linux and macOS builds. There is a subsequent change for making it work for Windows builds. All in all, this now allows proper mixing of debug / release versions of the Python interpreter with debug / release versions of PySide2 on Linux and macOS. Task-number: PYSIDE-508 Change-Id: I88a05c3ada0fb32c7c29bdb86d7a2c15acc963b8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* libpyside: Use Q_SLOTS instead of slotsFriedemann Kleint2017-06-021-1/+1
| | | | | | | | | When mixing Python and C++, Qt needs to be used with 'CONFIG += no_keywords' to suppress the 'slots' macro definition, which clashes with a Python header. Task-number: PYSIDE-526 Change-Id: I4feeae2de21db712b4de6653e243d556623436a1 Reviewed-by: Christian Tismer <tismer@stackless.com>