aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/libpyside
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.13' into devFriedemann Kleint2019-07-053-5/+34
|\ | | | | | | Change-Id: I71a1165ef9dea0eb084b271a0362c3f1e12829e3
| * Add support for parameterNames in SignalsCristian Maureira-Fredes2019-07-043-5/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were many uses cases when a proper interaction between Python and Qml was needed, one of them was the case to emit signals from Python an get those values via an argument name in QML. A simple example describing this situation can be found in PYSIDE-634: Python: sumResult = Signal(int, arguments=["sum"]) sumResult.emit(42) Qml: onSumResult: console.log(sum) // will print 42 A test case based on the same example was added. Change-Id: I0908f97d88eaadc0c02d81bc4daca936f72f6c6a Fixes: PYSIDE-634 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.13' into devFriedemann Kleint2019-07-0317-421/+420
|\| | | | | | | Change-Id: I389468b76913ac3c8113ab89833c756a7a72e54f
| * Cleanup pointer and trailing whitespace (omissions)Christian Tismer2019-06-251-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "Cleanup pointer whitespace" patch was augmented by some C++11 changes. Unfortunately, this was done in the same commit, and so some old whitespace that was removed could re-appear invisibly, since it was in the original version. This fix tries to remove all trailing whitespace and also adds a few " *" corrections that were lost. The "type *" entries in XML files were changed back to "type*". Change-Id: Ic5c945ad64a47455fb15eebdf184b126af5ecd1d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| * Cleanup pointer whitespace everywhereChristian Tismer2019-06-2416-410/+409
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Among other files to fix, basewrapper.(cpp|h) was full of uncommon pointer whitespace. After fixing that, I could not resist and fixed also libshiboken, generators, and after acceptance also PySide. Most of the time, this regex worked fine (\w\w+)([*&]+)[ ]*(?![&*]*[/=]) replaced with \1 \2 but everything was checked by hand. I did not touch the shiboken tests which are quite hairy. It turned out that inserting a space between a variable and asterisk causes a crash of shiboken, if the same line contains "CONVERTTOCPP". This was temporarily fixed by adding another space after it. Example.. sources/pyside2/PySide2/glue/qtcore.cpp line 977 QByteArray * cppSelf = %CONVERTTOCPP[QByteArray *](obj); //XXX /|\ omitting this space crashes shiboken! cppgenerator.cpp was special, since it was modified to _generate_ correct pointer whitespace. This caused a few testcases to fail, which had to be adjusted, again. This was difficult since some internal names must end on "*" and generated code normally not. Removing the last errors involved binary search on path sets... Apply C++ 11 fixits to the changed code, where applicable. Done-with: Friedemann.Kleint@qt.io Task-number: PYSIDE-1037 Change-Id: I4ac070f52c5efb296c05d581c9d46e6f397a6c81 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into devFriedemann Kleint2019-06-191-16/+40
|\| | | | | | | Change-Id: I5aa8f69849db51c61d058b7f0197b883b7d2d4e2
| * Fix negative refcount on QSocketNotifierChristian Tismer2019-06-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change 43451e3bc17467593df64cb73ce8c0bf9e60045f from 2018-05-09 introduced a refcount bug that was not caught because we do not build with debug Python. This also revealed an omission in the patch "PySide: Allow any existing attribute in the constructor" when debug Python is used. Change-Id: Idbcbbc87f0a83bb696d03e05af0cf616b21f7335 Fixes: PYSIDE-1027 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| * PySide: Allow any existing attribute in the constructorChristian Tismer2019-06-041-16/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are signals and properties which are correctly supported in PySide by the function "fillQtProperties". The structures are introspected by calling "QMetaObject::indexOfSignal" and "QMetaObject::indexOfProperty". By allowing any property, extending the above restriction, we break the Qt API slightly, but have the tremendous advantage of being able to write all needed properties into the constructor call. This approach is a compromize that keeps the attribute calls as they currently are. Supporting real properties where we actually have getter and setter functions would be possible as well, but that would break compatibility very much! It has to be discussed if we want to support a configuration switch that enables this incompatible change. If we would go this far, then I would do this together with changing mixedCase to lower_case. A simple test case has been added. Task-number: PYSIDE-1019 Change-Id: I8094df51d63aa767a5a9ec1c83bcf7db7b157a01 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Fix deprecation warnings about deprecated container conversionsFriedemann Kleint2019-05-221-1/+1
|/ | | | | | | | Fix warnings introduced by qtbase/92f984273262531f909ede17a324f546fe502b5c. Change-Id: Ic46e5c93f8dd1910742fbd0578602cca4461643b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Port property/signal/slot handling of libpyside to use QByteArrayFriedemann Kleint2019-05-066-227/+171
| | | | | | | | | | Introduce C++ structs with QByteArray to be used for signal and slot names and signatures, removing a lot of code dealing with char * pointers, strdup() and reallocating. Change-Id: I28acf727bc6cf468285b153c85b0a342fd79f7d8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* libpyside: Refactor code building the signatureFriedemann Kleint2019-05-021-4/+4
| | | | | | | | | The function slotCall() used the now deprecated function QString::sprintf(). Rewrite the code using QByteArray since converting to QString and back is wasteful for the purpose. Change-Id: Ifcd50e76bb7ea0c9d2f2e7453c6e265abe6265b7 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Modernize cmake buildAlexandru Croitor2019-02-073-31/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a CMake super project that includes the shiboken2, PySide2 and pyside2-tools subprojects, so that it's possible to build everything from Qt Creator (or any other IDE that supports CMake) with minimal set up effort, and thus inform the IDE CMake integration of all relevant files, for easier code editing, navigation and refactoring. This also lays the foundation for allowing 3rd parties to use the shiboken2 generator to generate custom modules. This is achieved by eliminating various hardcoded paths for libraries and include directories. Start using CMake targets throughout the build code to correctly propagate link flags and include dirs for libshiboken and shiboken2 executable targets. Same for the libpyside target. Generate two separate cmake config files (build-tree / install-tree) that can be used with find_package(Shiboken2), to make sure that the PySide2 project can be built as part of the super project build. This is currently the only way I've found to allow the super build to work. Note that for the build-tree find_package() to work, the CMAKE_MODULE_PATH has to be adjusted in the super project file. The generated config files contain variables and logic that allow usage of the installed shiboken package in downstream projects (PySide2). This involves things like getting the includes and libraries for the currently found python interpreter, the shiboken build type (release or debug), was shiboken built with limited api support, etc. Generate 2 separate (build-tree and install-tree) config files for PySide2, similar to how it's done for the shiboken case, for pyside2-tools to build correctly. Install shiboken2 target files using install(EXPORT) to allow building PySide2 with an installed Shiboken2 package (as opposed to one that is built as part of the super project). Same with PySide2 targets for pyside2-tools subproject. Make sure not to redefine uninstall targets if they are already defined. Add a --shorter-paths setup.py option, which would be used by the Windows CI, to circumvent creating paths that are too long, and thus avoiding build issues. Output the build characteristics / classifiers into the generated build_history/YYYY-MM-DD_AAAAAA/build_dir.txt file, so it can be used by the test runner to properly filter out blacklisted tests. This was necessary due to the shorter paths options. Fix various issues regarding target includes and library dependencies. Remove certain duplicated cmake code (like limited api check and build type checks) in PySide2, given that that information will now be present in the exported shiboken2 config file. Include a short README.cmake.md file that describes how to build the super project. References used https://rix0r.nl/blog/2015/08/13/cmake-guide/ https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/ https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1 https://cliutils.gitlab.io/modern-cmake/chapters/basics/functions.html https://cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html https://github.com/ComicSansMS/libstratcom/blob/master/CMakeLists.txt Abandoned approach using ExternalProject references: https://cmake.org/cmake/help/latest/module/ExternalProject.html https://stackoverflow.com/questions/44990964/how-to-perform-cmakefind-package-at-build-stage-only Fixes: PYSIDE-919 Change-Id: Iaa15d20b279a04c5e16ce2795d03f912bc44a389 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Propagate Property attributes to the MetaObjectCristian Maureira-Fredes2019-02-071-0/+11
| | | | | | | | | | | | | | | The attributes were ignored when a new Property was being add to the MetaObject. The addProperty method was only creating a new QProperty with the name and default values. The way of setting the attributes comes from: src/corelib/kernel/qmetaobjectbuilder.cpp specifically QMetaObjectBuilder::addProperty. Change-Id: Id81a274b3c2ae9d6b3413ebd54c776cefa392a38 Fixes: PYSIDE-924 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Replace the deprecated Qt algorithms by their std:: equivalentsFriedemann Kleint2019-02-051-1/+2
| | | | | | | | | | | | | | Fix warnings occurring in 5.13: sources/shiboken2/ApiExtractor/abstractmetalang.cpp:1431:66: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator, LessThan) [with RandomAccessIterator = AbstractMetaFunction**; LessThan = bool (*)(AbstractMetaFunction*, AbstractMetaFunction*)]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/cppgenerator.cpp:358:43: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator) [with RandomAccessIterator = Include*]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/cppgenerator.cpp:1683:55: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator) [with RandomAccessIterator = QList<QString>::iterator]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/cppgenerator.cpp:5500:53: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator) [with RandomAccessIterator = Include*]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp:1585:65: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator, LessThan) [with RandomAccessIterator = AbstractMetaFunction**; LessThan = bool (*)(const AbstractMetaFunction*, const AbstractMetaFunction*)]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp:1681:24: warning: ‘void qSort(Container&) [with Container = QStringList]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp:2054:25: warning: ‘void qSort(Container&) [with Container = QStringList]’ is deprecated: Use std::sort [-Wdeprecated-declarations] Change-Id: If6940941ac31327597ce362a31b27773f4d5b94c Reviewed-by: Christian Tismer <tismer@stackless.com>
* 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>