aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/qtdocparser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* shiboken6/Documentation: Prominently display QML typesFriedemann Kleint2024-12-131-25/+16
| | | | | | | | | | | | | | | | | | | Previously the link to the QML types list (Qt web documentation) was automatically inserted into the last paragraph of the module description. This only had an effect when no PySide module description was present. Otherwise, it had to be manually added to the module description which was overlooked for some modules. To fix this, extend the module documentation obtained from the doc parsers by the URL to page and format it as a separate section preceding the class list. Remove the QML types from the PySide module descriptions. Pick-to: 6.8 Task-number: PYSIDE-1106 Change-Id: I0b107a81b239405c0258ecff924aef87472f13b0 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Remove unused code from the doc parsersFriedemann Kleint2024-12-131-5/+0
| | | | | | | Pick-to: 6.8 Task-number: PYSIDE-1106 Change-Id: Ib276e2cb6c6d3db14e7c65e7e464dae4a5be3d8b Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6/Documentation: Fix abuse of the TypeSystem::Language enum in ↵Friedemann Kleint2024-12-091-1/+1
| | | | | | | | | | | | | DocModification DocModification only used 2 values from TypeSystem::Language (native/target), which match the native/target values of enum Documentation::Format. Move the enumerations from class Documentation to a global header and use them in DocModification for consistency. Pick-to: 6.8 Change-Id: I154f2208b4d834fed569555ef4c0579502bb32f7 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Add a documentation file hint to complex type entriesFriedemann Kleint2024-11-281-18/+26
| | | | | | | | | | | | | | | | | | | | Complements ad5eb64daaaa1b927bcbf9e568738f417fef845f. Add a doc-file attribute to complex type entries (object/value/namespaces) like it was done for enums and free functions by ad5eb64daaaa1b927bcbf9e568738f417fef845f. This is mainly intended for namespaces that can be extended by other modules. Change the functions to parse WebXML to accept lists of files. Improve the error message about not finding qdoc files. Pick-to: 6.8 Task-number: PYSIDE-2918 Task-number: PYSIDE-1106 Change-Id: I2811e0715b7f44a4461876019580295f5af4ea06 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Documentation: Use function parameter names from WebXML/qdoc when they are ↵Friedemann Kleint2024-11-211-31/+54
| | | | | | | | | | | | missing In some cases, the Qt headers do not have parameter names. Use the ones from the WebXML documents in that case. Pick-to: 6.8 Task-numer: PYSIDE-1106 Change-Id: I719a4fb09b9fbef9fc734036e3f53c02376a5d5f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6/Documentation: Introduce a doc-package typesystem attributeFriedemann Kleint2024-09-271-7/+44
| | | | | | | | | | | | | | | Make it possible to specify an alternate doc-package for locating the WebXML files generated by qdoc. For example the documentation of the QtMultimediaWidgets module is generated into the QtMultimedia module. This became a problem after the module split qttools/c51980bb0d9658f2ade4de1900d07b08e88cb52d. Task-number: QTBUG-77650 Task-number: PYSIDE-2620 Task-number: PYSIDE-1106 Change-Id: I09ab50f7e3b56c0a7d0f2e94e593a8d5e83b2001 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6/Documentation: Fix WebXML module documentation nameFriedemann Kleint2024-09-271-8/+9
| | | | | | | | | | Complements 752c1161d75f8c01e2c6c6b07ba02e9a62e65b10. Task-number: QTBUG-77650 Task-number: PYSIDE-2620 Task-number: PYSIDE-1106 Change-Id: If6865f2db8ebc8fb40894603c57ec13e7b26bced Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6/Documentation: Add source file to the Documentation classFriedemann Kleint2024-09-271-8/+9
| | | | | | | | | | | This is useful for resolving images. Use it for the module documentation. Task-number: QTBUG-77650 Task-number: PYSIDE-2620 Task-number: PYSIDE-1106 Change-Id: Ib7843541af75aa179ac7d862fc30351f69f550ed Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6/Documentation: Return documention source file from the DocParser ↵Friedemann Kleint2024-09-261-4/+6
| | | | | | | | | | | (doxygen/qdoc) As a drive-by skip private fields in doxygen instead of quitting. Task-number: PYSIDE-2620 Task-number: PYSIDE-1106 Change-Id: Ieb488e6168d736aa1b11e2737eb118fdb3f485cd Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Documentation: Adapt paths for 6.8Friedemann Kleint2024-09-051-8/+29
| | | | | | | | | Adapt to qttools/c51980bb0d9658f2ade4de1900d07b08e88cb52d. Task-number: QTBUG-77650 Task-number: PYSIDE-2620 Change-Id: Icc083c9b3d768093f45caa5d7a3c54aec5eb2d4f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Fix static analysis warningsFriedemann Kleint2024-06-241-3/+3
| | | | | | | | | | | | | | | | | | - Initialize variables - Use auto * - Use const references to prevent copies - Remove const from function returns - Remove repeated return types - Fix else after return/throw - Make functions const/static where appropriate - Add missing override - Fix some invocations of static methods - Fix some int types (qsizetype) to avoid lossy conversions - Minor cleanups - Remove some macros Change-Id: I414b8451703b136f135383289de49e743e84fb3a Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Extract global (non-added) function/enum documentationFriedemann Kleint2023-12-191-17/+98
| | | | | | | | | | Try to determine the name of the .webxml file in which the documentation is via include/doc file hint and write that to the globals page. Task-number: PYSIDE-1106 Change-Id: I8042d9122fa9037a602aadc2266d85d1f79f4fde Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Documentation: Adapt struct ClassDocumentation for header documentsFriedemann Kleint2023-12-191-2/+3
| | | | | | | | | | | Global functions and enumeration appear as WebXml documents with a <header> element instead of class <class>. Extend the ClassDocumentation and its parse to represent that. Change the parsing to return an optional and remove the operator bool. Task-number: PYSIDE-1106 Change-Id: I2e0413904dd8a5859aa9ed2aea9522aa5f24e939 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* DocGenerator: Further preparations for generating global functions/enumsFriedemann Kleint2023-12-121-2/+2
| | | | | | | | | | | | | | | | QtDocGenerator::writeInjectDocumentation() previously had class and function as parameters and was used for class documentation (function == 0) as well as function documentation. Split it into separate functions for both cases such that class can be 0 in the function case for global functions. Remove the indentation, which appeared to be misguided. Add separate functions for querying the XPATH modifications. Task-number: PYSIDE-1106 Task-number: PYSIDE-2543 Change-Id: I78a25f100b810abb542d82be56c4473816bb8c82 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Remove some further uses of QStringLiteralFriedemann Kleint2023-11-291-2/+2
| | | | | | Task-number: PYSIDE-2537 Change-Id: Ie71b17eec385b31842d6693b3492db565d479fd0 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Remove inline functions using QStringLiteralFriedemann Kleint2023-11-291-7/+7
| | | | | | | | | | Replace the formely used static inline QString foo() { return QStringLiteral("foo"); } by latin1 literals. Task-number: PYSIDE-2537 Change-Id: Ia4e9827e2b2a2f65f06751d549e8d79002386878 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Port from QSharedPointer to std::shared_ptrFriedemann Kleint2023-01-051-8/+8
| | | | | | | Task-number: QTBUG-109570 Change-Id: Iabdafb0a5ab211e32c1bbf7face78fd5102a49b9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Use smart pointers for AbstractMetaClass instancesFriedemann Kleint2022-12-061-7/+7
| | | | | Change-Id: I101ca8ceea6ffa63ca8bd03e2e9adf7531cb8f80 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Generate property documentationFriedemann Kleint2022-11-251-11/+0
| | | | | | | | | | | | | | | | | | | | Previously, the documentation generator used to insert the property documentation at the getter/setter function documentation. The properties for use with true_property are hard to discover in this scheme. To fix this, add a separate TOC section and description list for the properties using the sphinx :py:property: directive and link to it from the functions and signals instead. This mimicks the C++ documentation. Task-number: PYSIDE-1106 Task-number: PYSIDE-1019 Pick-to: 6.4 Change-Id: I976fee91a02ca4c8a7c62c7d957ecaea59ac4ebc Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Store the property documentation in QPropertySpecFriedemann Kleint2022-11-241-1/+6
| | | | | | | | | | | | Similar to AbstractMetaFunction and AbstractMetaClass, store the documentation (brief/detail) in QPropertySpec. Task-number: PYSIDE-1106 Task-number: PYSIDE-1019 Pick-to: 6.4 Change-Id: Ide236b5918c135e331149ca384ed973fd794b55f Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* shiboken6: Use smart pointers for the TypeEntry classesFriedemann Kleint2022-11-171-1/+1
| | | | | | | | | | TypeEntry instances were previously stored and passed as raw pointers, which made it difficult to track ownership, particularly when synthesized classes were added. Change it to use QSharedPointer. Change-Id: I3612efbc5d467ebeac9aa5dda86c7439bbd03ddd Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Fix coding style regarding pointers (Type* v -> Type *v)Friedemann Kleint2022-11-141-4/+4
| | | | | | | | | As a drive-by, introduce some auto and streamline the code. Pick-to: 6.4 Change-Id: If84a3721a50b2e00b473ba78cba184f1a35d326b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Documentation: Indicate enum typesFriedemann Kleint2022-11-081-1/+11
| | | | | | | | | Insert the base class into the WebXML doc string. Pick-to: 6.4 Task-number: PYSIDE-1735 Change-Id: I5b59df98f929c82112903bb316143b592c06e33e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Port some loop variables to qsizetypeFriedemann Kleint2022-10-131-1/+1
| | | | | | | | Where possible, used range-based for. Otherwise, use qsizetype for loop variables. Change-Id: I4773bee8468ce73722656ec73845369b7d40d4cd Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Clean up includesFriedemann Kleint2022-09-211-1/+2
| | | | | | | | | Remove unused includes from headers; add includes to sources where needed. Change-Id: I05efd95a9340eaf42cc5d606e2aef97acdaf83c7 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* shiboken6: Split the document modifications in ComplexTypeEntryFriedemann Kleint2022-09-051-24/+10
| | | | | | | | | | | | Split into function modifications (with signature) with a new accessor and let the old accessor return the class modifications only. Add a helper function DocParser::getDocModifications() to retrieve the modifications. Task-number: PYSIDE-2025 Change-Id: I1f8b3eb0cfa4b121910329cd76b0a67559d76fca Reviewed-by: Christian Tismer <tismer@stackless.com>
* Use SPDX license identifiersLucie Gérard2022-05-271-27/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: I065150015bdb84a3096b5b39c061cf0a20ab637d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Split the typesystem headerFriedemann Kleint2022-05-171-1/+2
| | | | | | | | It was growing too large to be maintainable. Change-Id: I7d646fa92a08dd598d673c81668210c1b188b635 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Remove deprecated QLatin1StringFriedemann Kleint2022-04-251-7/+11
| | | | | | | | | | Introduce a compatibility header to provide the 6.4 API to 6.3 to reduce merge conflicts. Task-number: QTBUG-98434 Pick-to: 6.3 6.2 Change-Id: Iab3f9f894019b4135afa96b930325966348210d0 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Migrate from QLatin1String to UTF-16 string literalsFriedemann Kleint2022-04-251-2/+2
| | | | | | | | | | Use the QStringView overloads of the comparison functions in order to minimize merge conflicts after the deprecation of QLatin1String in 6.4. Task-number: QTBUG-98434 Pick-to: 6.3 6.2 Change-Id: Ia0df398ab8f3e61a0b629971ccbec2273a78499b Reviewed-by: Christian Tismer <tismer@stackless.com>
* Migrate from QLatin1Char to UTF-16 char literalsFriedemann Kleint2022-04-251-5/+5
| | | | | | | | | Preparing for the deprecation of QLatin1Char in 6.4. Task-number: QTBUG-98434 Pick-to: 6.3 6.2 Change-Id: I8bc92aa9f4e6dbfcb12d2025c5a1e760ab4f0d7f Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix include conventionsFriedemann Kleint2022-04-221-1/+1
| | | | | | | | | Reorder includes such that local includes are first, followed by Qt and C/C++ system includes. Pick-to: 6.3 6.2 Change-Id: Ib801d34de7242befce4be429bfb099ccabe1f987 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* doc: use https in some source code filesCristián Maureira-Fredes2022-03-311-1/+1
| | | | | | | Pick-to: 6.2 Change-Id: Ic48c1016638cb6fca544139ef589223b45c656c7 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* shiboken6/Documentation: Fix Qt module description extractionFriedemann Kleint2022-03-141-5/+5
| | | | | | | | | - Fix the module index webxml file name. - Fix the link to the QML type pages. - Add a special case for QtQuickControls2 Change-Id: I7c4b4cf8451d6d21dc43ad137d79f890674a944c Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6/Documentation: Replace XPath/Xquery usage for retrieving WebXML ↵Friedemann Kleint2021-12-161-203/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | docs by a parser shiboken used XPath expressions to extract the function descriptions from the qdoc-generated WebXML. With the deprecation of QtXmlPatterns in Qt 6, libxml/xslt was used for this. A major drawback is that libxml/xslt is unable to match entities in attributes which means functions taking parameters by const-ref could not be found. This required cumbersome workarounds involving repeated searches, which still were not sufficient to find all functions. To fix this, write a WebXML parser based on QXmlStreamReader that extracts the contents of a WebXML page into some simple data structures and use those for searching. On this occasion, also use the metafunction flags to correctly match binary operator functions. This reduces the number of functions for which no documentation can be found (from ~1100 to ~800 for the qtbase repository). From the remaining functions, ~230 are functions inherited from templates, which should at least be listed. Others are caused by qdoc not finding hidden friends. The remaining usages of libxml/xslt are the doxygen parser and the documentation modifications using XSLT. Task-number: PYSIDE-1106 Change-Id: I31c045ad42948afad884f40d5bbc8bee7555859e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix documentation generationFriedemann Kleint2021-12-101-51/+124
| | | | | | | | | | | | | | | | | | | | | | | | The fuzzy checking introduced by 87efa57c6ddc1a8364b2ea4d9f909372d0af5cfc actually produced ambiguous matches like QStandardItemModel::insertRow(QStandardItem *), QStandardItemModel::insertRow(constd QList<QStandardItem *> &). Change this to be a 3 step process: First, try an exact type match. If that fails and there are arguments using const ref qualifications, try a fuzzy match. Check whether this produces a single match. Finally, try matching by argument count. As a drive-by, format qualifiers of template parameters like QList<QStandardItem *> correctly. Change the messages to report "Fallback used" instead of "Cannot find" if a fallback is found to make it easier to spot failures. Amends 87efa57c6ddc1a8364b2ea4d9f909372d0af5cfc. Pick-to: 6.2 Change-Id: I5b133274ae0f056e6901b0a66d385a270cabb9c9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Documentation: Fix warnings about not finding functions in WebXMLFriedemann Kleint2021-12-091-11/+37
| | | | | | | | | | | | | | | | | | | | When searching functions by name and parameter types in the WebXML pages, 4000 warnings like Cannot find documentation for function QWhatsThis::showText(QPoint,QString,QWidget*) in ...whatsthis.webxml using query: /WebXML/document/class[@name="QWhatsThis"]/function[@name="showText" and @const="false" and count(parameter)=3]/parameter[1][@type="const QPoint &"]/../parameter[2][@type="const QString &"]/../parameter[3][@type="QWidget *"]/../description Falling back to "void showText(const QPoint &pos, const QString &text, QWidget *w)" obtained by matching the argument count only. appear. This is caused by libxslt apparently being unable to match entities like &amp; in XQuery expressions, so, this fails for const-ref parameters like "const QString &". To fix this, use "contains()" instead in the query. Pick-to: 6.2 Change-Id: I5fe9edb3d2eab911b69a69e4a68cf9fd3f27677b Reviewed-by: Christian Tismer <tismer@stackless.com>
* Refactor class DocumentationFriedemann Kleint2021-04-281-5/+7
| | | | | | | | | | | | | | 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>
* shiboken6: Refactor handling of the brief class documentationFriedemann Kleint2021-04-201-3/+33
| | | | | | | | | | | | 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>
* shiboken6: Store AbstractMetaFunction using a QSharedPointerFriedemann Kleint2020-11-301-9/+12
| | | | | | | | | | | | | | | | | | Store the list functions (global / class member) as a QList<QSharedPointer<const AbstractMetaFunction> instead of a raw pointer list. This makes passing around function lists easier and solves the memory leaks caused by mixing cloned and unmodified functions while collecting the overload lists in the generators. - Change the function signatures accordingly - Add a qSharedPointerConstCast() for non-const access. - Restructure the traversing of added functions in the AbstractMetaBuilder - Remove some unused typedefs and functions unearthed by the change Change-Id: I08a6c5243750e3eb3813bc3f7172899ad2b13e22 Reviewed-by: Christian Tismer <tismer@stackless.com>
* AbstractMetaFunction: Introduce private classFriedemann Kleint2020-11-111-0/+1
| | | | | | | Prepare it for caching the lists of function modifications. Change-Id: Icbe19be760a49278ed4af75534bc73d36f4b1a96 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Port QPropertySpec to use QSharedDataPointerFriedemann Kleint2020-11-111-1/+2
| | | | | | | | | | Change the client code to store it by value. Use a std::optional to replace the pointer. Replace the pointer QPropertySpec* stored in AbstractMetaFunction by a the index of the property in the enclosing class. Change-Id: Iffca9e0a6f311534ba001dc2b34bbf5ff7c01813 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Port AbstractMetaEnum/Value to use QSharedDataPointerFriedemann Kleint2020-11-111-3/+3
| | | | | | | | Change the client code to store it by value. For the various find() and traverseEnum() functions, use a std::optional to replace the pointer. Change-Id: Ie4e671bf95e569741fa3c9a399bfe239ceac0dec Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Introduce a private class hierarchy for TypeEntryFriedemann Kleint2020-11-101-0/+1
| | | | | | | | | | | | | | | | | Move the data members of the TypeEntry classes to private classes, using convenience macros modeled after Qt's Q_D macro. The main motivation here is header hygiene and decoupling; typesystem.h was including a lot of classes. This requires moving some code around: - Move the debug formatting helpers of the TypeEntry classes from typedatabase.cpp to typesystem.cpp. - Move struct TypeRejection to typedatabase.h - Reorder typesystem.cpp in order of declaration. Change-Id: I24fe501d98940afd44caf75057cd6131cfbd6b6e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Split the abstractmetalang headers and sourcesFriedemann Kleint2020-11-061-0/+3
| | | | | | | | Split out enums, fields and functions. Only AbstractMetaClass remains in abstractmetalang.h. Change-Id: I49846f92fafc5969d83aa4a1767eb4ac23f39d1c Reviewed-by: Christian Tismer <tismer@stackless.com>
* Rename shiboken2 to shiboken6Friedemann Kleint2020-10-281-0/+358
Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I4cb5ee4c8df539546014b08202a7b1e98ed3ff07 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>