aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2
Commit message (Collapse)AuthorAgeFilesLines
* Windows: Fix encoding in custom message handlerFriedemann Kleint2020-05-061-1/+1
| | | | | | | | | | The code snippet passing the message to the Python handler used QString::toLocal8Bit() to convert the message. This is wrong as Python always requires UTF-8. Fixes: PYSIDE-1293 Change-Id: I1f16dad970aaf0d776e748110fc2054269412047 Reviewed-by: Christian Tismer <tismer@stackless.com>
* qareaseries: keep references of lower/upper seriesCristian Maureira-Fredes2020-05-041-1/+12
| | | | | | | | | Increasing the refcount since otherwise the objects will be GCd. Fixes: PYSIDE-1285 Change-Id: I9bb03c64f6ba9385de4ee892ce370bb2f827d79e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* QMutexLocker allow-thread in constructorCristian Maureira-Fredes2020-04-301-1/+7
| | | | | | | | | | | | | | | | | | After the improvement to the GIL treatment inside PySide to avoid UI freezing issues, many functions need an entry on the typesystem to allow thread explicitly, this was the case of the report, where a QMutexLocker was initialized. The initialization was done inside a QThread run method, so the lack of allow-thread was generating a deadlock. The nogil section of the code (from Cython) was not related to the issue, since replacing the content with any instruction produced the deadlock anyways. Fixes: PYSIDE-1271 Change-Id: Ib1fd1ebd923c3f9dc9ae390228bcf40b5b878019 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Q*Mutex allow-thread in lock/tryLock and remove unlockCristian Maureira-Fredes2020-04-301-3/+2
| | | | | | | | | | | | | In case someone manually lock/tryLock a QBasicMutex inside a section where threads are allowed, the lack of the attribute will end on a deadlock. Additionally, this removes the allow-thread for unlock() in QMutex, since is not needed. Task-number: PYSIDE-1271 Change-Id: I3d394c77d1b876afe324d5a50eb5da11b271c30e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* signature: Fix and simplify for mypy compatibility, Part 2Christian Tismer2020-04-225-15945/+4697
| | | | | | | | | After regeneration of the registry, we need to restore the blacklist.txt file, fix the scrape script and use the newly generated registry files. Task-number: PYSIDE-1100 Change-Id: I2f73e36a9cc9bfb1e07b8a08ab67ddd63e211e81 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* signature: Fix and simplify for mypy compatibilityChristian Tismer2020-04-215-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a problem with the typing module for Python2 that showed the wrong name. The generated signature files are further simplified. They no longer contain fancy definitions like "Char", which made little sense and was replaced by "int", which our competitor does as well. The mypy compatibility should be considered mostly complete. Update.. QChar was not changed to "int" but "str" because we got clashes. Therefore, recreation of the registry was necessary. Hard to solve stay the definitions "Virtual, Missing, Invalid, Default, Instance". They are very rarely used for special cases. Mypy cannot see these definitions since the module path does not exist in the file system. I tried hard to fix this by building a mypy plugin, but I seem to be forced to generate real files in a temp dir. This was too much effort. A plugin may make sense in the future when we need to improve the type support. Change-Id: Id80c2da1a4a379a80ec5f3019a916a9c00cc87ff Task-number: PYSIDE-1100 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Support type checking with the mypy moduleChristian Tismer2020-04-173-0/+8
| | | | | | | | | | | | | | | According to PEP 561, there needs to exist a py.typed file. Also, the import of typing must be visible statically for mypy without importing PySide2. Testing.. run mypy pyside_1100.py and you will get the correct output without "any". Change-Id: I1d08447161630a8c7a64eda32ff8a431e994c6a7 Fixes: PYSIDE-1100 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Fix race condition with unprotected Py_INCREFsChristian Tismer2020-04-081-0/+7
| | | | | | | | | | | | | | | | | | The signalmanager module contains a PyObjectWrapper object into which PySide::SignalManager::qt_metacall calls via many hard-to-track indirections. Finding this problem was quite tricky. It was done by modifying the Py_INCREF and Py_DECREF macros of a debug Python interpreter and using the new PyGILState_Check function to provoke a crash if the GIL was not held. See the online documentation for details. Change-Id: Ida8246c97dcf6443ff057d206a42d22e462f1913 Fixes: PYSIDE-813 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix alloc-dealloc-mismatch in MetaObjectBuilderMilian Wolff2020-04-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QMetaObjectBuilder::toMetaObject uses malloc to allocate the space for the returned QMetaObject. As such, we need to use free instead of delete, otherwise ASAN will report an error: ``` 39: ==1537629==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete) on 0x61200006cf40 39: #0 0x7f7952f00960 in operator delete(void*) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cc:165 39: #1 0x7f7930c4d8d4 in void qDeleteAll<__gnu_cxx::__normal_iterator<QMetaObject const* const*, std::vector<QMetaObject const*, std::allocator<QMetaObject const*> > > >(__gnu_cxx::__normal_iterator<QMetaObject const* const*, std::vector<QMetaObject const*, std::allocator<QMetaObject const*> > >, __gnu_cxx::__normal_iterator<QMetaObject const* const*, std::vector<QMetaObject const*, std::allocator<QMetaObject const*> > >) /usr/include/qt/QtCore/qalgorithms.h:320 39: #2 0x7f7930c4cf98 in void qDeleteAll<std::vector<QMetaObject const*, std::allocator<QMetaObject const*> > >(std::vector<QMetaObject const*, std::allocator<QMetaObject const*> > const&) /usr/include/qt/QtCore/qalgorithms.h:328 39: #3 0x7f7930c4a847 in PySide::MetaObjectBuilder::~MetaObjectBuilder() ../3rdParty/PySide2/sources/pyside2/libpyside/dynamicqmetaobject.cpp:143 39: #4 0x7f7930c54c8f in PySide::GlobalReceiverV2::~GlobalReceiverV2() ../3rdParty/PySide2/sources/pyside2/libpyside/globalreceiverv2.cpp:208 39: #5 0x7f7930c54ccf in PySide::GlobalReceiverV2::~GlobalReceiverV2() ../3rdParty/PySide2/sources/pyside2/libpyside/globalreceiverv2.cpp:223 39: #6 0x7f7930c54f63 in PySide::GlobalReceiverV2::decRef(QObject const*) ../3rdParty/PySide2/sources/pyside2/libpyside/globalreceiverv2.cpp:271 39: #7 0x7f7930c553fc in PySide::GlobalReceiverV2::qt_metacall(QMetaObject::Call, int, void**) ../3rdParty/PySide2/sources/pyside2/libpyside/globalreceiverv2.cpp:338 39: #8 0x7f7941d2e251 (/usr/lib/libQt5Core.so.5+0x2db251) 39: #9 0x7f7941d28bef in QObject::destroyed(QObject*) (/usr/lib/libQt5Core.so.5+0x2d5bef) 39: #10 0x7f7941d2c8d6 in QObject::~QObject() (/usr/lib/libQt5Core.so.5+0x2d98d6) 39: 39: 0x61200006cf40 is located 0 bytes inside of 264-byte region [0x61200006cf40,0x61200006d048) 39: allocated by thread T0 here: 39: #0 0x7f7952efdd48 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:153 39: #1 0x7f7941d1d742 in QMetaObjectBuilder::toMetaObject() const (/usr/lib/libQt5Core.so.5+0x2ca742) 39: #2 0x7f7930c4bb88 in PySide::MetaObjectBuilder::update() ../3rdParty/PySide2/sources/pyside2/libpyside/dynamicqmetaobject.cpp:425 39: #3 0x7f7930c54a85 in PySide::GlobalReceiverV2::GlobalReceiverV2(_object*, QSharedPointer<QMap<QByteArray, PySide::GlobalReceiverV2*> >) ../3rdParty/PySide2/sources/pyside2/libpyside/globalreceiverv2.cpp:195 39: #4 0x7f7930c50a70 in PySide::SignalManager::globalReceiver(QObject*, _object*) ../3rdParty/PySide2/sources/pyside2/libpyside/signalmanager.cpp:313 39: #5 0x7f792ec3b257 in getReceiver 3rdParty/PySide2/sources/pyside2/PySide2/QtCore/PySide2/QtCore/qobject_wrapper.cpp:155 39: #6 0x7f792ec3b67f in qobjectConnectCallback 3rdParty/PySide2/sources/pyside2/PySide2/QtCore/PySide2/QtCore/qobject_wrapper.cpp:205 39: #7 0x7f792ec3e5b9 in Sbk_QObjectFunc_connect 3rdParty/PySide2/sources/pyside2/PySide2/QtCore/PySide2/QtCore/qobject_wrapper.cpp:944 39: #8 0x7f7943a66250 in PyObject_Call (/usr/lib/libpython3.8.so.1.0+0x13c250) ``` Change-Id: I8c5a745fab9785425c0844129731c7c8a17b8d21 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Revert "shiboken: Add XML attribute to turn off method caching"Friedemann Kleint2020-04-061-1/+1
| | | | | | | | | | | | This reverts commit fcbbab0a6b5949b5c3726214ed87898b5fbcebcc. This is no longer required after a fix generating the property code into the setattro methods of QObject-derived classes. Task-number: PYSIDE-803 Task-number: PYSIDE-1255 Change-Id: I9e989c0592eaaf25aa55a1db49537daa4bdb2a57 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Fix Qt properties not working in classes inheriting QObjectFriedemann Kleint2020-04-052-0/+133
| | | | | | | | | | | | | The fixes for PYSIDE-803 caused setattro methods to be generated for many classes, resulting in QObject's setattro method no longer being called. Generate property code in each class inheriting QObject. Task-number: PYSIDE-803 Fixes: PYSIDE-1255 Change-Id: I56f52fb43c4ddc77914090ac122776050354ddbe Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide2: Fix lockups in QMetaObject.invokeMethod with BlockingQueuedConnectionFriedemann Kleint2020-04-041-0/+1
| | | | | | | | Add allow-thread. Change-Id: I7feba9761a52c273cf4500a42dfbea0463d6040f Fixes: PYSIDE-1253 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Adapt UI files tutorial to newly added UiLoader exampleFriedemann Kleint2020-04-031-3/+8
| | | | | | | | Amends cf8e0d98821cc7e6f0fc48b56a0a16ad88cd881b. Task-number: PYSIDE-841 Change-Id: Iea6ab04e2ce8c4fb77d7d5c770dc45005f2635dc Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Fix dict access without GILChristian Tismer2020-04-022-1/+5
| | | | | | | | | | | | | | | In PYSIDE-803 we used an optimization that accessed a dictionary without holding the GIL. This turned out to be not correct, because PyDict_GetItem works with thread state to maintain the global error variables. PyDict_GetItemWithErrors can be used instead in a way that allows releasing the GIL. Task-number: PYSIDE-803 Task-number: PYSIDE-813 Change-Id: Ifb0cbb20c21ca9c8b3d099fff1db5410eb6824b4 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Update sbkstring to use PyUnicode_GetLengthChristian Tismer2020-03-301-1/+1
| | | | | | | | | | | | | | | | | | | | The unicode implementation has changed very much. PyUnicode_GET_SIZE has been used all the time, although this macro is already a quite expensive real function since Python 3.3 . The function is deprecated, and the macro PyUnicode_GET_LENGTH should be used, instead. This is relevant for cleaning things up, because in the course of fixing PYSIDE-813 we work with debug Python, which then complains that Python memory is used without holding the GIL. The usage of the right implementation was ensured by a function PepUnicode_GetLength and removing all traces of the former version. Task-number: PYSIDE-813 Change-Id: I62e94e10e14975dac3dad0ed1fffec8a1b54a0d5 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* doc: add clarification to examples pageCristian Maureira-Fredes2020-03-301-1/+6
| | | | | | | | | | New users are getting confused by the phrasing of the page, and believe we only have two examples in our codebase. Adding a paragraph to clarify this situation will solve the misconception. Change-Id: I2a18d99771eee82af3181a997c137109840edbec Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Add doc getter for PropertyCristián Maureira-Fredes2020-03-251-0/+27
| | | | | | | | | | | | | | | | This allows to access the doc attribute from Properties when set: >>> p = Property(int, doc="some doc") >>> p.__doc__ some doc >>> p = Property(int) >>> p.__doc__ None Fixes: PYSIDE-135 Change-Id: Idf3e6c6632c775a50cfc8ecf03de3d2dc485f9f4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Invert QTreeWidgetItem clear function loopCristian Maureira-Fredes2020-03-251-1/+9
| | | | | | | | | | | When using clear on an item with children, we rely on the childCount() function so when children with only a parent and no local reference were inside, they ended up being removed, altering the behavior of the loop. Change-Id: I111a600cd2e805eeb7110082437e666f88ff65a5 Fixes: PYSIDE-1251 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PySide2: Use int for QVariant conversion when possibleFriedemann Kleint2020-03-253-6/+23
| | | | | | | | | | | Check using the init limits in the QVariant long long conversion and create an int if possible. This works more smoothly with Qt and for example ensures that the correct editor is created in item views. Change-Id: I0ca2e5e7b91f309deaa81a25e70a5f894f43f841 Fixes: PYSIDE-1250 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add functions with callback of QWebEnginePageFriedemann Kleint2020-03-244-8/+229
| | | | | | | | | Provide them as user-added functions using C++ lambdas. Fixes: PYSIDE-946 Task-number: PYSIDE-1241 Change-Id: I9733bc98b3fc8b3bcf40ab4ce91ffdb84e385b93 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Adjust the allow-thread behaviorCristián Maureira-Fredes2020-03-139-118/+122
| | | | | | | | | | | | | | | | | This adds and remove the usage of: allow-thread="yes" in some typesystem entries. This also adapt the usage of the Py_BEGIN/END_ALLOW_THREAD macro inside the snippets used by other typesystem entries. The main reason is that in some cases not the whole snippet requires to be inside such state, but only when calling the C++ equivalent function. Task-number: PYSIDE-803 Change-Id: Ifa9c8cee2713c453e4d5c624aaa862e75559180c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Avoid the GIL in SignalManager::retrieveMetaObjectChristian Tismer2020-03-092-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After massive GIL savings in the generated code, there still exists a place where a lot of repeated GIL acquirements are done. It was observed that up to 24 consecutive calls to retrieveMetaObject(self) were made, all with the same value for 'self'. The code in question was: (1) Shiboken::GilState gil; (2) MetaObjectBuilder *builder = metaBuilderFromDict( \ reinterpret_cast<SbkObject *>(self)->ob_dict); (3) if (!builder) (4) builder = &(retrieveTypeUserData(self)->mo); (5) (6) return builder->update(); An exact analysis of the code showed that the GIL usage (1) could be moved out of the function into a deeper function that does updates in a branch (6). Function retrieveTypeUserData does not involve the Python interpreter at all (4). It took some time until it was proven that access to some special Python dictionary cannot reach the Python interpreter and therefore does not need the GIL as well (2). This replaces the abandoned effort to write a "Lazy GIL". It worked great for the example program, but had problems with some never finishing tests. After all, this solution is much simpler and works perfectly well. More effort seems not to be necessary to handle the GIL. Task-number: PYSIDE-803 Change-Id: I439009ff933fc6f498beb0c7f1523b6f985afda8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Add QDeadlineTimerFriedemann Kleint2020-03-062-0/+5
| | | | | | | | | | | | | The class will replace timeout parameters in Qt 5.15 as introduced by qtbase/72f57cc84244633ca69ede9a1fd510b9b1881c1d, causing warnings like: Stripping argument #1 of bool QThread::wait(QDeadlineTimer) due to unmatched type "QDeadlineTimer" with default expression "QDeadlineTimer(QDeadlineTimer::Forever)". Stripping argument #2 of bool QWaitCondition::wait(QMutex*,QDeadlineTimer) due to unmatched type "QDeadlineTimer" with default expression "QDeadlineTimer(QDeadlineTimer::Forever)". Stripping argument #2 of bool QWaitCondition::wait(QReadWriteLock*,QDeadlineTimer) due to unmatched type "QDeadlineTimer" with default expression "QDeadlineTimer(QDeadlineTimer::Forever)". Change-Id: I51655ef19d8276b95c2a759d5ba44287a4b6d91b Reviewed-by: Christian Tismer <tismer@stackless.com>
* Accept EnumMeta as a valid Signal typeCristián Maureira-Fredes2020-03-043-1/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | Including a check for Python EnumMeta types to not consider them as a normal PySequence allows the decision to use the default PyObject wrapper case. Using the 'object' type is currently the workaround, so this allow the users to use the Enum class instead of declaring the signal with 'object'. class A(Enum): a = 1 b = 1 # Workaround # signal = Signal(object) # With this patch signal = Signal(A) A test case was added. Fixes: PYSIDE-239 Change-Id: Ib593dba5a988eceb8b1bfae097768e9ec02be6d5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Add XML attribute to turn off method cachingFriedemann Kleint2020-03-031-1/+1
| | | | | | Task-number: PYSIDE-803 Change-Id: I0ba80cea5804e1b83cc55ee32163ca9d021ccd26 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix running the PySide2 tests for Python 3.8/WindowsFriedemann Kleint2020-02-28479-332/+2512
| | | | | | | | | | | | | | | | | | | | | On Windows, DLL directories can no longer be specified via the PATH environment variable. They need to be added via os.add_dll_directory(). In order to fix this, move the entire environment setup from CMake to a python helper and set the environment variables BUILD_DIR and QT_DIR pointing to the build directory and Qt directory, respectively, from CMake. In addition, this has a huge advantage: The tests can also be executed much more easily without ctest from the command line by just setting BUILD_DIR and QT_DIR instead of a complex manipulation of PATH/LD_LIBRARY_PATH. Change-Id: I7d518ccab19ca184c3112a126c779d4a6d7c6c5e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add some qApp documentationChristian Tismer2020-02-271-1/+51
| | | | | | | Updated to the new simple builtin variable. Change-Id: I918ce7bc9aea6451439a8306d5bbd325c04e8136 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Unify the py3kcompat.py test helpersFriedemann Kleint2020-02-273-103/+47
| | | | | | | Put everything into a single file and mark them as copies. Change-Id: I782247520d6976695a14f762e8247e5c4eb46aac Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* docs: Add information about internal toolsCristián Maureira-Fredes2020-02-261-5/+53
| | | | | Change-Id: I1d814b72359e188ba8263b0cb583ccb43af5e4b4 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix web_engine_custom_scheme.pyFriedemann Kleint2020-02-241-6/+33
| | | | | | | | | | | | | | Introduce a flag to distinguish timeouts from successful loading. Register the scheme properly and set "Path" syntax, fixing the warning: Please register the custom scheme 'testpy' via QWebEngineUrlScheme::registerScheme() before installing the custom scheme handler. Add required initializations of QWebEngine and embed the view into a top level widget, as using a QWebEngineView as a top level on Windows hangs. Change-Id: Id39a6b14606795216994928ad82f60435f4caaca Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Turn qApp into a normal Python variable, finallyChristian Tismer2020-02-217-54/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After a long odyssey of more or less unpythonic compromizes, the qApp "macro" would finally be moved into a normal variable without surprizes. This was only possible since we removed qApp from QtWidgets and other modules. Otherwise, from PySide2.QtWidgets import * would pull qApp, being the constant "None", into main and shadow the true qApp variable in the builtins. By inserting qApp into the builtins, only, we make sure that this variable is always freshly looked up, without making it change its contents. DONE... + change the singleton code to normal + rename to MakeQAppWrapper + simplify the implementation + fix new bug concerning duplicate applications + check very much for refcounting bugs + review the rest of the implementation and further simplify Note... The Q*Application variable will not be turned back into a GC variable. This is not worth the effort. Fixes: PYSIDE-571 Change-Id: Idbd158c083318e6b0dfe48d62485c68c90e944de Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Pyside2/tests: Split the helper moduleFriedemann Kleint2020-02-20205-373/+535
| | | | | | | | | | The classes of the helper module were defined in the __init__.py file with complicated logic to test for presence of the modules. Split the classes apart and empty the __init__.py file (still required for Python2). Change-Id: I4f4971f9a48e2961233da5585aa0df53bfbb9c7a Reviewed-by: Christian Tismer <tismer@stackless.com>
* Make PySide2 tests using the helper modules from 'util' self-containedFriedemann Kleint2020-02-19224-74/+1001
| | | | | | | | | | Add the relative import path to locate the modules "helper" and "py3kcompat". The tests can then be launched from the command line without the ctest environment. Change-Id: Ia50663d7381b52cb248de3e4d23002a195ca9139 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Improve the libdir for windowsCristián Maureira-Fredes2020-02-181-1/+8
| | | | | | | | | | | | | | | | | | With virtualenv 20 we have the case where the first path in the PYTHON_LIBRARIES cmake variable was wrong: a_virtual_env/libs/python3.lib so the python code inside the helper didn't have a proper check if the file was valid or it was just a wrong construct. Additionally, the 'prefix' variable will contain the virtual environment directory location, which will not contain the 'libs' directory, because that's included in the system's installation path. To solve this, we use the 'INCLUDEPY' directory, which is correct as a base to create the real 'libs' one. Task-number: PYSIDE-1231 Change-Id: Ifca08d74c49cd57572836a087edb96c089266dc7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Bump versions stringsSimo Fält2020-02-121-1/+1
| | | | | Change-Id: I4ed952681abe6f42ff43a567f70fdc7e6512ddcc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix testrunner for Python 3.8/LinuxFriedemann Kleint2020-02-071-4/+18
| | | | | | | | | | | | | | | | | | | When running tests with Python 3.8/Linux, the existence_test fails: File "pyside-setup/sources/pyside2/tests/registry/existence_test.py", line 73 from init_platform import enum_all, generate_all File "pyside-setup/sources/pyside2/tests/registry/init_platform.py", line 59 from util import get_refpath, get_script_dir File "pyside-setup/sources/pyside2/tests/registry/util.py", line 113 platform_name = "".join(distro.linux_distribution()[:2]).lower() AttributeError module 'platform' has no attribute 'linux_distribution' since platform.linux_distribution() was removed in 3.8. Extract into a separate method and warn to install distro. Task-number: PYSIDE-939 Change-Id: I42d04830d51563cc3fbaddc3941c927402514480 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix build on Windows using Python 3.8Friedemann Kleint2020-02-061-10/+37
| | | | | | | | | | | | | | The DLL load behavior was changed in Python 3.8 to no longer search the PATH variable for DLL dependencies. This means that the shiboken2.dll from the shiboken2 package is no longer found. Add the shiboken2 package using os.add_dll_directory() to fix this. Unfortunately, this requires additional work during the build process, Qt and libpyside2.dll need to be found in the build directory. Change-Id: I3d78d8df2d6f64913e06fa44e7e1aadbc1a14b58 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Create best-matching wrapper for unknown classes inheriting QObjectFriedemann Kleint2020-02-061-2/+19
| | | | | | | | Walk up the MetaObject hierarchy until a matching type is found. Fixes: PYSIDE-1214 Change-Id: I474edbfc710375951987e43469b7e7ea4366ab0c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* QList/QTable/QTreeWidget: Fix ownership of return valueFriedemann Kleint2020-02-051-0/+18
| | | | | | | | Specify C++ ownership. Fixes: PYSIDE-1189 Change-Id: I093e2af048aaabf00d124af66dcd3efc7c709e95 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix PyBuffer interface for QByteArrayCristián Maureira-Fredes2020-02-052-1/+15
| | | | | | | | | | | | | For the limited API, properly implement the PyBUF_ND flag (shape requested). Otherwise, use the convenience function PyBuffer_FillInfo() to properly populate the view. Fixes: PYSIDE-1204 Change-Id: I2a4c81885cf49b25c89823577c0d7ee2f2707b87 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix Python 3.8 warnings about deprecated int conversions of enums/flagsFriedemann Kleint2020-01-291-1/+7
| | | | | | | | | | | | Set Py_nb_index to the conversion method for flags and enums. Fixes warnings like: examples/widgets/widgets/tetrix.py:107: DeprecationWarning: an integer is required (got type PySide2.QtCore.Qt.AlignmentFlag). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python. Task-number: PYSIDE-168 Task-number: PYSIDE-939 Change-Id: Id41a72474192b357afd3dacd0a2e2fc5e055775c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix grammar in considerations.rstChristian Tismer2020-01-291-2/+2
| | | | | Change-Id: I7d840367d9a733d925bbfeb78a0ba0c9c076e6c0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Let qApp be noApp instead of pretending to be NoneChristian Tismer2020-01-294-16/+16
| | | | | | | | | | | | | | | | | | | | qApp should stay almost as it is with only two cosmetic changes: When qApp's return value has Type(Py_None), the value now reports "noApp" instead of "None". Also the feature of "del __builtins__.qApp" is replaced by function qApp.shutdown() . This makes things easier to explain and avoids refcounting hacks. The embedding problem (Falkon browser) was too complicated. We finally solved it by disabling qApp in embedded mode. Change-Id: I0d99661137130684823aa3d1978b494d8ab08e59 Fixes: PYSIDE-1158 Fixes: PYSIDE-1178 Fixes: PYSIDE-1135 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* docs: QML and SQL integration tutorialMariana Meireles2020-01-276-0/+598
| | | | | Change-Id: I6ba4ae9fe6a9bfe669b76a23f27556b1f3c59eb4 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* docs: More fixes on deployment and faqKavindra Palaraja2020-01-274-62/+86
| | | | | Change-Id: I97d7251b0d9ec024ce069f6475d7bc6be0d9d362 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* libpyside: Set default signal name only if previously assignedCristián Maureira-Fredes2020-01-271-1/+2
| | | | | | | | | | Just before registering the signal to the meta-object, the signalName was overwritten instead of checking if it had some content. Fixes: PYSIDE-1192 Change-Id: I5fc85bf22ae08bce6969b9381662288a99aee616 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix ownership of QTextDocument::createObjectCristián Maureira-Fredes2020-01-241-1/+2
| | | | | | | | | | Since it's a virtual method, we need to specify that the native counterpart of the method will live in C++, and in the target scope it will live in Python. Fixes: PYSIDE-1207 Change-Id: I5b9072380eed17270affa39c5976dc6b1fe293ff Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* docs: Fix pre overlap and improve readingCristián Maureira-Fredes2020-01-241-2/+1
| | | | | | | | | | | | | Removed the color and the padding on the 'pre' elements of the docs. Additionally increased the line-height globally to 1.4 to make the reading easy. Fixes: PYSIDE-1201 Change-Id: I292d4e6da616ecb84a923444b99ad28a28d6cc5d Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* libpyside: avoid freeing char*Cristián Maureira-Fredes2020-01-241-4/+2
| | | | | | | | | | The doc parameter was being freed causing a segmentation fault, according to the implementation of the parse function, it's not necessary to free. Fixes: PYSIDE-1205 Change-Id: I5850e7feaf354b27cc4496dc83be214d1729a048 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken: Introduce "until" version attribute as opposite of "since"Friedemann Kleint2020-01-241-1/+5
| | | | | | | | | | Prototypically use it for QMessageLogContext, allowing to elegantly build for Qt from version 5.12..now using a single type system file. Fixes: PYSIDE-1191 Change-Id: Iaa7bdc10c7129d84c54e85a09a1c802a409708f9 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>