aboutsummaryrefslogtreecommitdiffstats
path: root/sources
Commit message (Collapse)AuthorAgeFilesLines
* doc: snippets_translate make quiet mode by defaultCristian Maureira-Fredes2021-04-281-4/+1
| | | | | | | | | | | | | | | | | Without being 'quiet' the script was generating output to the stdout and stderr, which was triggering the cmake instruction to make the build fail This change makes the quiet mode by default, the old output that summarize each snippet file can be obtained by using the '--verbose' option. A new option called '--debug' was introduced to get even more output related to each translation happening per file. Pick-to: 6.0.4 Change-Id: I7fce09f0b60e626c957efc4fe24948e0eaf3db74 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Tests: Use new form of super()Friedemann Kleint2021-04-2882-112/+112
| | | | | Change-Id: Id0a6c5e67f53623cc6d41ccc377218479931ee65 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add context management for QSignalBlockerFriedemann Kleint2021-04-283-1/+17
| | | | | | | Add __enter__/__exit__ modeled after QReadLocker. Change-Id: I6e8f93adf4e957bd20179c902aa429fb88f2537b Reviewed-by: Christian Tismer <tismer@stackless.com>
* Refactor class DocumentationFriedemann Kleint2021-04-287-62/+88
| | | | | | | | | | | | | | Replace the map by two fields of string type for detailed/brief and add accessors. Make the constructor explicit and fix all occurrences of implicit conversions. Change QtDocGenerator::writeFormattedText() to take a QString with the format instead of an instance of Documentation and add convencience functions writeFormattedBriefText() and writeFormattedDetailedText(). Change-Id: I4efaecc8cffeff16873fa3926c3f3b731b96bc5b Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6/Windows: Fix encoding of QCoreApplication.arguments()Friedemann Kleint2021-04-273-0/+78
| | | | | | | | | Encode in the console's code page via wchar_t. Fixes: PYSIDE-1425 Change-Id: Ideae87361409a61919ea6bf8d5594609dceaa1cb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Tests: Use per-class importsFriedemann Kleint2021-04-2760-340/+396
| | | | | Change-Id: I6dac1f54152fecab7af6831bc3c813a016408aae Reviewed-by: Christian Tismer <tismer@stackless.com>
* Test bug_686.py: Fix warning about destroying a locked QReadWriteLockFriedemann Kleint2021-04-271-0/+2
| | | | | | | | | | Unlock in the threads, fixing warnings: QReadWriteLock: destroying locked QReadWriteLock QReadWriteLock: destroying locked QReadWriteLock Pick-to: 6.0 5.15 Change-Id: I484b7947fdcf241fca069c02ecd9e0ff7c20c151 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Tests: Fix star importsFriedemann Kleint2021-04-2773-118/+169
| | | | | Change-Id: If4e1d64af662b1802f2f748121bda5488a82235a Reviewed-by: Christian Tismer <tismer@stackless.com>
* UiTools: Remove dependency on QtXmlFriedemann Kleint2021-04-272-2/+0
| | | | | | | | The module only uses QXmlStreamReader/Writer. Change-Id: Icb58251dc800cc7c3cb8827b431ded1744baf639 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* PySide6: Fix the test HTTP serverFriedemann Kleint2021-04-271-1/+1
| | | | | | | | | | | | | | Change the test data to be a bytearray, fixing: File "sources/pyside6/tests/util/httpd.py", line 47, in do_GET self.wfile.write(TestHandler.DATA) File "/usr/lib/python3.8/socketserver.py", line 799, in write self._sock.sendall(b) TypeError: a bytes-like object is required, not 'str' Pick-to: 6.0 Change-Id: I5a0b5d0f76c4245fc7209d17a6c7f1e664cbc04f Reviewed-by: Christian Tismer <tismer@stackless.com>
* doc: fatal error when snippet conversion failsCristian Maureira-Fredes2021-04-261-1/+5
| | | | | | | | | | | | | | | | | | | | | | When the snippets_translate tool fails, the build process continues normally, falling back to use the original C++ snippets. This problem can be dangerous, since we will not notice if something is wrong without checking the full log. This patch make the build process to fail when the tool doesn't exit normally. For builds where the documentation generation is skipped, this change will have no effect. Complementary to this, the patch includes a new Python file to determine if the C++ include have an import counterpart in Python. Fixes: PYSIDE-1527 Pick-to: 6.0.4 Change-Id: I725b623f60dbc540a6e7834502300c39cd22b5a3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6: Fix injecting documentation for added functions with parameter namesFriedemann Kleint2021-04-232-4/+28
| | | | | | | | Strip the parameter names from the modification signature so that it matches the C++ type signature. Change-Id: I8ca4e124e3c579d222d52f949f0d01b44eae92bf Reviewed-by: Christian Tismer <tismer@stackless.com>
* Add documentation for the numpy overloads of functions taking point listsFriedemann Kleint2021-04-232-3/+15
| | | | | | | | | Amends 6389561fd75e80c69d7c83f6a87d988450a2e569. Task-number: PYSIDE-1540 Task-number: PYSIDE-1503 Change-Id: I0f424dccf4151d53d64f3aef923a32d3c3bf2641 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Fix XML errors when injecting target format (RST) documentationFriedemann Kleint2021-04-221-1/+1
| | | | | | | | | | In writeInjectDocumentation(), pass class Documentation (including format) instead of just the string to writeFormattedText() to prevent it from running through XMLToSphinx. Pick-to: 6.0 5.15 Change-Id: I6116552fc3ea8f7ddc1cc07d51370f868de97bb3 Reviewed-by: Christian Tismer <tismer@stackless.com>
* cmake: add dependencies to rebuild libshiboken embedded files, addendumChristian Tismer2021-04-211-0/+1
| | | | | | | | | | | There was one file forgotten when adding dependencies. This was recognized when back-porting the original change to 5.15 . Task-number: PYSIDE-1536 Change-Id: I5c396e8de47c716acb9e301d60930296bd530a64 Pick-to: 6.0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Add a numpy overload for some functions taking lists of QPointFFriedemann Kleint2021-04-215-1/+47
| | | | | | | | | | | | | | | | | | | | Add functions taking x,y data in the form of numpy-vectors (as common for matplotlib, etc) for: QPainter::drawPoints() QXYSeries::append(), QXYSeries::replace() They are added as separate functions instead of overloads since there is a restriction in that numpy arrays cause an error: FIXME Subscripted generics cannot be used with class and instance checks when passed to other type check macros. Task-number: PYSIDE-1540 Task-number: PYSIDE-1503 Change-Id: Ie1521ce19127bb0641fbdb4f7320a8707682724e Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside: Add helpers for numpyFriedemann Kleint2021-04-214-0/+289
| | | | | | | | | | | | Add utility functions for converting numpy vectors containing x,y data to list of QPoint, QPointF, respectively along with helpers for type checking and initialization. Task-number: PYSIDE-1540 Task-number: PYSIDE-1503 Change-Id: Idde5084434a36ec31eb87bf65dec3d637cff728b Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Build system: Make numpy centrally availableFriedemann Kleint2021-04-211-22/+6
| | | | | | | | | | | In order to be able to use numpy in PySide6 modules besides libshiboken, move the numpy detection into the build scripts and pass it as a CMake variable. Task-number: PYSIDE-1540 Task-number: PYSIDE-1503 Change-Id: Ib30fdbab83904878286b7eaae1674ffba0f2febd Reviewed-by: Christian Tismer <tismer@stackless.com>
* signature: Refine the decision heuristics of result tuplesChristian Tismer2021-04-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | | Result tuples do not (yet) get information from XML. Instead, they fetch their info solely from the embedded signature strings and information encoded in mapping.py . When a variable is determined as a result variable, it is removed from the arg list and normally appended to the return tuple. It turned out that a special rule is needed: A variable that comes first in the variable list should also be first in the result tuple. This heuristics should be replaced by more introspection. Right now, this suffices as a working fix. Fixes: PYSIDE-1409 Pick-to: 6.0 Pick-to: 5.15 Change-Id: Ib65682439e2f678380e0f58a42a36506d0766ddf Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Refactor handling of the brief class documentationFriedemann Kleint2021-04-204-37/+41
| | | | | | | | | | | | Move the extraction of the brief text from the QtDocGenerator to the QtDocParser and store the brief text in class Documentation, allowing for later extraction. The handling for qdoc and doxygen should then be consistent. Pick-to: 5.15 Change-Id: I86b37ae1c4a92f96508a03f5dbcfb6dc56014382 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6: Call reserve() when converting listsFriedemann Kleint2021-04-201-0/+6
| | | | | | | | | | | If a size can be obtained, add a call to reserve() to avoid reallocations for large lists. Task-number: PYSIDE-1540 Task-number: PYSIDE-1503 Change-Id: I95a8a6aa02641d9f174dbc3b63740a05d1d95a45 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* painter_test.py: Silence warnings about Painter being activeFriedemann Kleint2021-04-191-5/+14
| | | | | | | | Add QGuiApplication and let the painter paint on image, fixing: QPainter::setBrush: Painter not active Change-Id: I9f381e5b61c1798edaeb998be73f763aa4f2aff5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* PyPy-compat: Avoid the __builtins__ quirk and import builtins, insteadChristian Tismer2021-04-191-3/+4
| | | | | | | | | | | | | The use of __builtins__ is an old wart of Python. In some contexts this is a dict, in others it is a module. PyPy treats it always as a module. Instead of using the implicitly existing __builtins__ dict, we now import the builtins module which never fails. Task-number: PYSIDE-535 Change-Id: I71d14a69051b177273be2ce542694221bf61add2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* doc: update cx_Freeze urlElisabeth Ortega2021-04-182-2/+2
| | | | | | Pick-to: 6.0 Change-Id: I9c1cb964e1b9a05f9940382d58ecdf820865d532 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* doc: use sphinx panels in shiboken docsCristian Maureira-Fredes2021-04-182-2/+71
| | | | | | | | | | Replacing the old raw HTML for online docs. The HTML version of the menu will remain for qthelp. Pick-to: 6.0 Task-number: PYSIDE-1112 Change-Id: I335b25c561ab9d45fd041d24ec607b8d603612c1 Reviewed-by: Christian Tismer <tismer@stackless.com>
* signature: Support numpy PyArrayObjectFriedemann Kleint2021-04-161-0/+1
| | | | | | | Task-number: PYSIDE-1540 Task-number: PYSIDE-1503 Change-Id: If83d14ef228a137012c73414e5b6e5e0deb7ffbc Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6/typesystem: Replace remaining usages of QVector by QListFriedemann Kleint2021-04-152-14/+14
| | | | | | Pick-to: 6.0 Change-Id: I1c9fe1006cb936c88c860482ba93d0a68554a350 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Enable adding functions taking a numpy PyArrayObjectFriedemann Kleint2021-04-152-0/+6
| | | | | | | | | Add the correct check function for a numpy PyArrayObject. Task-number: PYSIDE-1540 Task-number: PYSIDE-1503 Change-Id: If7b25808edb65553fc0ee54ddf1532fe2d3c2272 Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6: Fix performance of QPainter::drawPoints(QPolygon)Friedemann Kleint2021-04-131-2/+7
| | | | | | | | | | | Reorder the overloads so that the QPolygon overload is checked first before the costly sequence type check of the QPoint list. Speeds up the example from 1800ms to 80ms. Fixes: PYSIDE-1540 Pick-to: 6.0 5.15 Change-Id: I108b0e98c82540703ee80345026ecdc3b55dfd4e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Prevent crashes when registering static fieldsFriedemann Kleint2021-04-134-13/+51
| | | | | | | | | | | | | | | Registering static fields invokes converters, which can cause crashes for uninitialized types (see also 2ac1870053370e017567ae53e62cd1155a01c88f). To solve this problem, move the static field initialization to the end of the module initialization function to ensure all converters are available. Pick-to: 5.15 6.0 Fixes: PYSIDE-1529 Change-Id: If40c6faf049077db8afcdee2069f4441c21beaa4 Reviewed-by: Renato Araujo Oliveira Filho <renato.araujo@kdab.com> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Use f-strings in testsFriedemann Kleint2021-04-1313-22/+22
| | | | | Change-Id: I52f92326fdd903078cce5b6408d96d742bfa42b8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add std::pair as a container in CoreCristian Maureira-Fredes2021-04-131-0/+10
| | | | | | | | | | | Since Qt6's QPair uses it underneath, we require to have a declaration so we are able to transform from and to Python. Fixes: PYSIDE-1544 Pick-to: 6.0 Change-Id: I9cc753cbbe0b352382996e896c00faff9bc0f819 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6: Join Modification into FunctionModificationFriedemann Kleint2021-04-134-121/+83
| | | | | | | | This completes b69d8899b1c592aa9a6cdfa43da3137af3fa16de, separating the modification classes. Change-Id: I7a8436facbce8a4ef8872b3867b21d62ae07fab7 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: get rid of some warningsChristian Tismer2021-04-126-40/+44
| | | | | | | | | | | | A few warnings are from libshiboken: Fix some clang analzyer warnings where const_cast is still needed in Python 3. Thanks for helping with auto writeConversionRegister = [this, &s](const AbstractMetaType &sourceType, const QString &targetTypeName, const QString &targetConverter) Change-Id: I487c9a5234dd1378c3a834076dd3bb204bb76cb8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PySide6: Add missing enumeration to QSslFriedemann Kleint2021-04-121-0/+1
| | | | | | Task-number: PYSIDE-1482 Change-Id: Ib616e96228c70e6db62aa7d733e9178938473ed5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* cmake: remove old test conditionsCristian Maureira-Fredes2021-04-072-8/+2
| | | | | | | | | There were some special cases with tests incompatibilities in old Qt version, which are not valid anymore. Pick-to: 6.0 Change-Id: I5787a1e749b14ed4f0fb463cbf9530496f5b182b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* cmake: bump general Qt minimum versionCristian Maureira-Fredes2021-04-075-6/+6
| | | | | | | | | | The main cmake files for pyside/shiboken still have minimum versions pointing to version <6.0.0 which is not valid anymore. Pick-to: 6.0 Change-Id: Iffebec1e6782e627fc6b3a0c9e16bce7864e250f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* cmake: update minimum Qt version for 6.0+ compatCristian Maureira-Fredes2021-04-076-43/+15
| | | | | | | | | | Bumping modules compatibility, using 6.0.0 as the base since we the rename from PySide2 took place already, and this code is not supposed to be backward compatible. Pick-to: 6.0 Change-Id: I471b151ef50f5a5974561bf2e619017f7beb621a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* cmake: add dependencies to rebuild libshiboken embedded filesChristian Tismer2021-04-074-28/+62
| | | | | | | | | | | | | | | | It was often a pain to handle embedded files correctly. Often, when embedding was used, one could not see any effect after re-compiling when --reuse-build was specified. This rendered the --reuse-build option often quite useless. The new approach adds dependencies for all involved Python files, and at the same time reduces them to a single list. Fixes: PYSIDE-1536 Pick-to: 6.0 Pick-to: 5.15 Change-Id: I6ef36c9ffccd2cd1ac290bb8e879b050f633eaf4 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* signature: protect an unrecognized item from raising exceptionsChristian Tismer2021-04-072-2/+14
| | | | | | | | | | | | | | | | | | A special case "std::optional" caused an exception at an unforeseen place, because "std" was not recognized in an eval. Turn this into another runtime warning. Also, the "std::optional" case was added as "typing.Optional" after applying und testing the above fix. Change-Id: I722ae463d133125e96ab09aeb38f21cdc2453d5b Fixes: PYSIDE-1538 Pick-to: 6.0 Pick-to: 5.15 Reviewed-by: Renato Araujo Oliveira Filho <renato.araujo@kdab.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Prospective fix for QPixmap/QDataStream serialization testFriedemann Kleint2021-04-071-3/+5
| | | | | | | | | | | The pixmaps are converted to QImage for conversion which seems to result in odd image formats in some cases. Use a transparent color to force alpha. Fixes: PYSIDE-1533 Pick-to: 5.15 Change-Id: I1499e18fa9d2176182c890171888b76153aef06f Reviewed-by: Christian Tismer <tismer@stackless.com>
* doc: make sure '--skip-docs' skip the docsCristian Maureira-Fredes2021-04-061-1/+1
| | | | | | | | | | | | | Even when using the code, some portions of the cmake file in sources/pyside6/doc/ was still being executed. This makes sure everything is skipped if we use the '--skip-docs' option when building. Pick-to: 6.0 5.15 Change-Id: If78b19b9650b61b642e447b8c96b814e82994d7c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* TestQSettings: Do not clutter the current directoryFriedemann Kleint2021-04-061-3/+7
| | | | | | | | | Put the settings file into a temporary directory, which ensures it is cleaned up. Pick-to: 6.0 5.15 Change-Id: Iacab066e1b1da20a8771a844e20751d1e5fb90d2 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Port tests to pathlibFriedemann Kleint2021-04-0632-79/+170
| | | | | | | | | | | | | Replace test helper function adjust_filename() by pathlib handling. Add asserts on the existence everywhere. Add error handling with helper functions to QML loading, printing the error message in the assert statements. Task-number: PYSIDE-1499 Task-number: PYSIDE-1532 Change-Id: I206929effb37f21d1f621be921bb996162398b4d Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* signature: remove inspect and typing from special PySide6 modulesChristian Tismer2021-04-018-70/+20
| | | | | | | | | | inspect and typing are removed from the signature module and the official ones are used. This is done as a clean-up before re-writing generate_pyi.py . Task-number: PYSIDE-1415 Change-Id: I3b580805775962447e65a2d7593ecf737e97536c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* feature-import: Hide confusing feature frame entryChristian Tismer2021-03-316-6/+91
| | | | | | | | | | | | | | | | | | | | The feature construct adds an extra level of indirection to the import command that shows up in tracebacks. This is quite irritating. To avoid these extra layer and much effort fo fix this in Python, it is more straight-forward to write a C function and - calls our redirection and returns if ok or error - calls the original import when feature not applicable. The change to the import function is made transparent by the builtin variables __orig_import__ and __feature_import__. Task-number: PYSIDE-1338 Task-number: PYSIDE-1019 Change-Id: Iacae6fbc47cf85f366f59ec3f6c5cca66d5ad65e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Write conversions as typing.Union[]Friedemann Kleint2021-03-296-19/+55
| | | | | | | | | | | | | | Extract all implicit conversions and write them as typing.Union[]. The optional_replacer was fixed, build_brace_pattern needed a separator to be able to continue. Missing mappings are added. Task-number: PYSIDE-1520 Change-Id: I2d8e4e7b8f1586036cc3ec9cf469a27e693e7312 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Nuitka: Allow for compiled functions and methods tooChristian Tismer2021-03-269-32/+213
| | | | | | | | | | | | | | | | | | | | | | The author of this patch is Kay Hayen. He writes: * Add support for compiled methods to the bindings manager. * For slots, implement lookup of code objects for compiled methods and functions with a new function avoiding code duplication. * Look up attributes of slots, e.g. code objects that Nuitka also has as well, methods have "im_func" and "im_self". * Sometimes calling "tp_descr_get" Python object slot is the universal thing to do, covering all types. * Detect compiled methods as receiver targets too. Task-number: PYSIDE-1523 Change-Id: I0277b583840710476198ed5e1ccaaccd672e7638 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* doc: enable snippets translate toolCristian Maureira-Fredes2021-03-25518-40945/+18
| | | | | | | | | | | | | | | | Create snippets directories in case they don't exist. Add "-q" option as the examples directory to keep the "--quiet" option from the build. Something to consider with this patch: Removing all the previous old snippets, which include not only 'cpp' files, but also '.h', '.qdoc', '.qrc', '.png', and '.qml', which might be used in the snippets, but will need to be updated in the generation tool, to not translate, and copy them over. Pick-to: 6.0 Change-Id: Icbef9e1c93a12b90dbcfa990ef055ca6f8868407 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix missing doc snippetsFriedemann Kleint2021-03-251-3/+9
| | | | | | | | | | Ensure doc snippets are copied to the build directory by creating a separate target. Amends 93ae3d9b38649e9d683a658a6a19b7623083f5a0. Pick-to: 6.0 Change-Id: Idfd3b55e79769fdceda64ee29bffae801eb9055b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>