aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator
Commit message (Collapse)AuthorAgeFilesLines
* shiboken: Add support for const Foo* fieldsFriedemann Kleint2018-08-291-4/+23
| | | | | | | | Task-number: PYSIDE-304 Task-number: PYSIDE-672 Change-Id: Ic0e8e9ada594f27a8224adfb43847b3b8149c33d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* libpyside: Fix spelling of retrive->retrieveFriedemann Kleint2018-08-241-1/+1
| | | | | | | 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-1/+3
|\ | | | | | | Change-Id: Ide71a89ef173d6f3e1fa6960f7b15f1fd6cc1bf1
| * Implement Proper Name ManglingChristian Tismer2018-08-211-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | shiboken: Reduce generated include statementsFriedemann Kleint2018-08-221-8/+0
| | | | | | | | | | | | | | | | Remove shiboken.h from the wrappers and some unneeded headers from the module header. Change-Id: Ib05433e77686e544e3dcae27f5256ae1bbf146e1 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Expose Shiboken generated Python module objectTilman Roeder2018-08-224-10/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | This change exposes the module object (a PyObject*) to the global namespace as Sbk[TYPESYSTEM NAME]ModuleObject. This is useful when generating bindings for cases where Python will run embedded into a host application. This variable is also included in the headers, where it is declared as `extern PyObject* Sbk[TYPESYSTEM NAME]ModuleObject;` for the convenience of developers reading the generated sources. Change-Id: Iaaa38b66b5d3aabc0fb8f995f964cd7aef2a11da Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | shiboken/doc generator: Fix crash when normalizing tablesFriedemann Kleint2018-08-211-1/+7
| | | | | | | | | | | | | | | | | | Do not rely on row 0 to obtain the maximum number of columns, search all instead. Change-Id: I6ddda89c191d1823b346e9e564f31a61de523426 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devFriedemann Kleint2018-08-021-0/+3
|\| | | | | | | Change-Id: Id7cf17491d2bc97f90ccd1db44837b6b66e90eb8
| * shiboken: Work around non-deterministic buildsFriedemann Kleint2018-07-261-0/+3
| | | | | | | | | | | | | | | | Request deterministic ordering of QHash. Task-number: PYSIDE-757 Change-Id: Ifec8f9d39cb183cffeb58440156204f2ccb56a2c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Generate anonymous int-type enums instead of index macrosFriedemann Kleint2018-07-302-41/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #define SBK_QMETAOBJECT_CONNECTION_IDX 158 #define SBK_QTEXTCODEC_CONVERTERSTATE_IDX 246 becomes: enum : int { SBK_QMETAOBJECT_CONNECTION_IDX = 158, SBK_QTEXTCODEC_CONVERTERSTATE_IDX = 246, which is more pleasing to the eye. Rename the helper _writeTypeIndexDefineLine() to _writeTypeIndexValue() for the enum values and split out a function that writes the value only so that some code duplication can be avoided. Change-Id: I0d51afbbe93e515ba1dce1275fa5a01a6bcd95ca Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Fix naming of the index macrosFriedemann Kleint2018-07-271-8/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor the functions and extract a helper so that: #define SBK_QFLAGS_QT_KEYBOARDMODIFIER__IDX becomes #define SBK_QFLAGS_QT_KEYBOARDMODIFIER_IDX Task-number: PYSIDE-757 Change-Id: I1d6d1e0c85f458af90cdffa787748b0da5ac7b85 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* | shiboken: Fix non-deterministic order of some SBK type indexesFriedemann Kleint2018-07-263-17/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change underlying type of the type database from a QHash<qualified_name, list of entries> to a QMultiMap<qualified_name, entry>. Previously, there was an allEntries() accessor and a function named entries() building a QHash<qualified_name, entry>. Simplify this so that there is only an entries() accessor returning the QMultiMap. Refactor the various Typedatabase::find() functions to operate on an iterator range of the QMultiMap. This unearthed some bugs: 1) In the generators, the call to findType(packageName()) would return the namespace entry for "sample" instead of the intended module type entry named "sample" due to the ordering. Add a new function to search for module type entries and assert that it finds it. 2) There was a duplicate, empty primitive type entry for QModelIndexList. Task-number: PYSIDE-757 Change-Id: I1814e4ca67d306e1488398507707cfd07b3f2c78 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Fix the allow-thread attribute to actually have an effectFriedemann Kleint2018-07-252-14/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, calls to BEGIN_ALLOW_THREADS/END_ALLOW_THREADS were always generated since the value of XML attribute was not used. Fix it to actually use the value. Since having it default to "no" caused a number of deadlocks (related to thread functions or functions calling a virtual function (potentially reimplemented in Python), introduce "auto" as default value. "auto" turns off BEGIN_ALLOW_THREADS/END_ALLOW_THREADS for simple getter functions. Task-number: PYSIDE-743 Change-Id: I4833afef14f2552c75b3424417c2702ce25cb379 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | shiboken: Output type database in debug modeFriedemann Kleint2018-07-241-1/+3
| | | | | | | | | | Change-Id: Id481aa5593c02c32656b141eaab6af800f978ebe Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devFriedemann Kleint2018-07-241-12/+12
|\| | | | | | | Change-Id: Ie90b31ed1b88f1353261fc4040db2d788df279e6
| * Pep 384 Final Cut: Remove PepTypeChristian Tismer2018-07-231-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Fix some clang-tidy warnings in shibokenFriedemann Kleint2018-07-2310-98/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 'else if' after return/break/continue - Use const ref for complex arguments passed by value where possible - Fix 'if (foo) delete foo' to 'delete foo' - Use container.isEmpty() instead of container.size() in checks - Use ' = default' for trivial constructors/destructors - Use range based for where possible - Complete constructor initializer lists - Fix invocations of static methods - Replace some reinterpret_cast by static_cast - Remove unused variables/fields - Use initializer lists for return types Change-Id: Id5b44a2f9d429f66ef069d532a1cd31df796d38e Reviewed-by: Christian Tismer <tismer@stackless.com>
* | shiboken: Add options for diff and dry-runFriedemann Kleint2018-07-231-0/+20
| | | | | | | | | | | | | | | | | | Refactor and breathe life back into the existing diff/dry-run functionality of class FileOut and make it available via command line options. Change-Id: I32e1e262c0c2e8f107776923477fe9714ad295cf Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devFriedemann Kleint2018-07-201-2/+7
|\| | | | | | | Change-Id: I1b6fdc6b0ac59dd726a9977620f1070bebf237a6
| * Generate fully Qualified Names for FlagsChristian Tismer2018-07-161-2/+7
| | | | | | | | | | | | | | | | | | 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>
* | shiboken: Fix command line helpFriedemann Kleint2018-07-192-10/+10
| | | | | | | | | | | | | | | | | | The one-character path options only take one path argument. Add parameter to the doc generator options. Task-number: PYSIDE-363 Change-Id: Ia1a0c1552a5d1e3ec86609e9899e985628874545 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | shiboken: Refactor command line arguments handlingFriedemann Kleint2018-07-167-179/+190
| | | | | | | | | | | | | | | | | | | | | | In main, replace the class ArgsHandler by plain QMap handling. Remove the args parameter of Generator::doSetup() and add a new virtual handleOption(key, value) to the generators instead. Add missing initialization. Change-Id: I9bc844172a81244f729d87a3d4262545e6433904 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Make revision and SBK index a member of TypeEntryFriedemann Kleint2018-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They were previously stored in a global hash, apparently due to BC issues. Replace the global set/getTypeIndex/Revision functions by member functions of TypeEntry in typedatabase.cpp. As a drive-by change, simplify the code assigning the SBK numbers to use a flat list of entries ordered by revision and name instead of a grouped hash (bearing in mind that revision is rarely used) and might be removed one day). Also replace the use of std::unique() by the !contains()/append() pattern since std::unique() assumes an ordered list which is likely not the case. Task-number: PYSIDE-725 Task-number: PYSIDE-743 Change-Id: I9356acf1f5795446c08f266c1323f1db65cd490c Reviewed-by: Christian Tismer <tismer@stackless.com>
* | shiboken: Fix Clang warningsFriedemann Kleint2018-07-121-25/+32
| | | | | | | | | | | | | | | | | | | | | | | | - Add Q_FALLTHROUGH() - Fix warnings about passing messages as format to qFatal() - Fix warnings about old-style casts - Fix warnings about comma operator - Fix warning about unreachable return Change-Id: Iaf31259c0f8156204f4d10ee0e594b89abbba5d3 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* | shiboken: Introduce enumeration for C++ indirectionsFriedemann Kleint2018-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | Replace the int "indirections" field of TypeInfo and AbstractMetaType by a Vector of an enumeration representing '*' and "* const". It is then possible distinguish between "int *" and "int *const". Task-number: PYSIDE-672 Change-Id: I68677fa515abb7e94217fc1c2b6ac28b42678284 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Streamline type parsingFriedemann Kleint2018-07-111-102/+17
|/ | | | | | | | | | | | | | | | Extract a static AbstractMetaType *AbstractMetaBuilder::translateType() method from the existing AbstractMetaBuilderPrivate::translateType() which can be passed the current class. Internally, add a AbstractMetaBuilderPrivate::translateTypeStatic() method that takes AbstractMetaBuilderPrivate parameter. Use that in conjunction with the TypeParse code to remove the type parsing code in ShibokenGenerator::buildAbstractMetaTypeFromString(). Task-number: PYSIDE-672 Change-Id: Ia17f0eb542099dcb843a59708110fc9d90fab12f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Remove unused code from the generatorsFriedemann Kleint2018-06-286-186/+15
| | | | | Change-Id: I88c4148000acba2ba1e2013fe587e7f5fbe6c2ca Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: No longer hard-code the C++ language levelFriedemann Kleint2018-06-271-0/+30
| | | | | | | | | | | | | | | | | | | The C++ language level was previously hard-coded in the default options. This is potentially problematic for projects using shiboken and also fell apart with Qt 5.12, where the experimental level "c++1z" used for MSVC2017/Clang 4 no longer works due to not being able to handle enumerator value deprecation attributes. Introduce an enumeration to represent the level and add functions to convert back to and forth to the respective Clang option. Add an option to shiboken. Add a function returning a default value for the emulated compiler, returning C++ 14 or C++1Z for the CMSVC2017/Clang 4 case. Task-number: PYSIDE-724 Change-Id: Ie7e19bf7f099a34e6cdaad4b462157a9a3ee8797 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix index() method of QAbstractItemModel-derived classesFriedemann Kleint2018-06-251-2/+12
| | | | | | | | | Prepend virtual methods when creating function groups so that overriding method the most-derived class is seen first. Task-number: PYSIDE-570 Change-Id: I791e3da09783c4c31ac293060aed8bb2bc8472d5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Add command line options for system include pathsFriedemann Kleint2018-06-221-18/+32
| | | | | | | | | Refactor class HeaderPath to contain an enumeration for the type instead of the boolean framework flag and add handling. Task-number: PYSIDE-693 Change-Id: I60a62b831ddd5ce7519a066135854ff723db2fc6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken/doc generator: Search snippets with to suffix "py" firstFriedemann Kleint2018-06-221-1/+7
| | | | | | | | | Replace .cpp by .py and try to find the snippet. Fall back to .cpp. Task-number: PYSIDE-363 Change-Id: I82b23df9894e626c97b44dc5a841f5fa70ae1d57 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Improve the QByteArray implementationBoxiang Sun2018-06-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | The available constructors for QByteArray are now: bytes, bytearray, and QByteArray, unicode is not accepted anymore. Also the concatenation is now possible between QByteArrays. Even though is not possible to initialize a QByteArray with an unicode, we include the possibility to compare it with one (Compatibility with PyQt). The __repr__ and __str__ are now properly working. There seemed to be a confusion regarding data types between Shiboken, Python2 and Python3 related to bytes, so now the structure is based on the flag SBK_BYTES_NAME, which is define as "bytes" for Python3 and "str" for Python2. Many tests were modified to properly handle string, using the `py3kcompat` module. Task-number: PYSIDE-232 Change-Id: I8b671f367c60a0870c72dcbe5662106b3225037d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* PEP 384-squash: Implement PEP 384Christian Tismer2018-05-302-250/+213
| | | | | | | | | | 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>
* QtXmlToSphinx::transform(): Improve XML error messageFriedemann Kleint2018-05-181-2/+4
| | | | | | | Output line and column. Change-Id: Ide890b93c47ef0fc9ebe3209356da100e0cbde4e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Make it possible to specify a target directory for additional documentationFriedemann Kleint2018-05-161-27/+44
| | | | | | | | | Introduce a simple [] notation for target directories. Task-number: PYSIDE-363 Change-Id: I3a0cd255faf84f564a64992cba88244ae14c2452 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* ShibokenGenerator::buildAbstractMetaTypeFromString(): Handle QFlagsFriedemann Kleint2018-05-141-3/+23
| | | | | | | | | | | | | | | | | | | | The function would fail for a QFlags type defined in a dependent typesystem file with errors like: Can't write the C++ to Python conversion function for container type 'QPair': Could not find type '::QFlags<QAccessible::RelationFlag>' for use in 'toPython' conversion. for example caused by QAccessibleWidget::relation() where the flag is defined in class QAccessible in QtGui. The underlying reason is that there is no type entry for the class QFlags. To work around this, detect it by looking at the instantiated types and create a flags type accordingly. Task-number: PYSIDE-487 Change-Id: Ib3c962aeedf8deb1a6b11976bd91316d39738310 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Improve error handling when writing type conversion functionsFriedemann Kleint2018-05-142-22/+48
| | | | | | | | | | Add an errorMessage parameter to ShibokenGenerator::buildAbstractMetaTypeFromString() and output the message in ShibokenGenerator::replaceConverterTypeSystemVariable(). Change-Id: I249778b3efe89c265590a7d4977cf2a4e76063f9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QtXmlToSphinx: Refactor link handlingFriedemann Kleint2018-05-072-46/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Forward declare QtXmlToSphinx::LinkContext as a public struct and move the definition to the source file. Replace the linkTag/linkTagEnding strings by an enumeration for the type and flags for storing the bold/italic state. Move the formatting to an operator<<(QTextStream,LinkContext) for clarity. Streamline the code checking the link text against the reference in handleLinkText(), avoiding some unnecessary tests. Add an 'External' type for external pages which do not have a role keyword. This fixes: - Undoes a breakage introduced by c5582d3120249a902681454b2319df765ffa2cd8 converting all link refs to RST labels, clobbering the '~' used for some function references. This is now limited to page type links. - Broken handling of links within italic/bold: The assignment to the linkTag variable by type would clobber the previously assigned italic/bold markers - Enable external links without role Task-number: PYSIDE-363 Change-Id: I2e9a8cd80df93a77f3c6c9f8593243b35eeeb56e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Change license from all the filesCristian Maureira-Fredes2018-05-0313-13/+13
| | | | | | | | | | | | | | | | | 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>
* QtXmlToSphinx: Add support for more elementsFriedemann Kleint2018-05-022-2/+41
| | | | | | | | | Add support for <target> and <page> elements for the additional documentation sections. Task-number: PYSIDE-363 Change-Id: I0b04106fbe6ae1779625de333368e18bbc31b962 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QtXmlToSphinx: Refactor label handlingFriedemann Kleint2018-05-022-6/+38
| | | | | | | | | | Add utility functions to remove invalid characters and a helper for streaming Task-number: PYSIDE-363 Change-Id: I45eb33ed60deed82912262a99551436c538eee22 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add option to create additional documentationFriedemann Kleint2018-05-022-4/+101
| | | | | | | | | | Add an option taking a list of files under the webxml directory that are run though the Sphinx converter to create .rst files. This can be used for tutorials and example descriptions. Task-number: PYSIDE-363 Change-Id: Ifa6df32517a2b336cd3f755523947d70c5c24f2e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Rename PySide references to Qt for PythonCristian Maureira-Fredes2018-04-2713-13/+13
| | | | | | | | | 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>
* shiboken: Accept relative file name as C++ headerFriedemann Kleint2018-04-271-1/+7
| | | | | | | | | | | Relative file names cause Clang not to find them since they are included by a temporary header file. Check and convert to an absolute path via QFileInfo. Change-Id: Ie87b4d2a6fcf5d98062a8a40a3eccbbb9513c62e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QtXmlToSphinx: Handle ordered listsFriedemann Kleint2018-04-241-7/+25
| | | | | | | | | | Introduce an enumeration for the list type and handle ordered lists like bullet lists with a different separator. Task-number: PYSIDE-640 Change-Id: I2e770f2dd56958627e423822b8f4b1c23fdd4e16 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Check default superclass when getting baseClassesCristian Maureira-Fredes2018-04-191-1/+7
| | | | | | | | | | | | | | | | | | | | | | | Reimplementing a class must respect the closest base class instead of falling back to QObject. By adding a default-superclass argument one can verify that field first when shiboken is getting the base classes. This problem was found by reimplementing QGraphicsObject including methods from one of its parent classes, QGraphicsItem. With this change, the generated wrapper will list all the base classes in `Sbk_QGraphicsObject_Type_bases` leaving QObject at the end, because if not, it will match inmediately. A test case was included. This change doesn't affect other existing tests. Task-number: PYSIDE-86 Change-Id: I6b9a220497b12c8085302a502f8581cc2d3fb11b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken: Use enum values from ClangFriedemann Kleint2018-04-191-1/+1
| | | | | | | | | | | | | | Remove a lot of ugly value parsing code in favor of clang_getEnumConstantDeclValue() and clang_getEnumConstantDeclUnsignedValue() depending on the type. Introduce a class EnumValue containing a union of qint64 and quint64 values to represent signed/unsigned values correctly and use that in the code model and meta language classes. Change-Id: If2efb7cfd560237907678b8f6fdfb0bc689c0c93 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Exclude smart-pointer-type from documentationFriedemann Kleint2018-04-192-0/+8
| | | | | | | | | | | | smart-pointer-type is a special type for making getter method and type known to shiboken. It should not be documented. Fixes a lot of warnings when trying to generate documentation for QtQuick.QSharedPointer. Task-number: PYSIDE-363 Change-Id: Icb26fa3e16cd74ae5115cdd1cbe32cb48ab5445b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Detect class enums by Clang entirelyFriedemann Kleint2018-04-191-4/+4
| | | | | | | | | | | | | | The Clang function clang_EnumDecl_isScoped() tells whether an enum is a class, so, there is no need to specify that in the typesystem. Use that information to pass it up to the metalang classes and revert the parts of 44cb6c51e6c3b43376f284941454dc8c13b81c3f that added it to the type system. Task-number: PYSIDE-487 Change-Id: Ie10885f74168821d0307e91b6f1f7f3f30dd074b Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Reformat helpFriedemann Kleint2018-04-193-14/+26
| | | | | | | | | Print option descriptions indented by 8 below the option instead of beside the option at column 38 and add some newlines to avoid wrapping. Change-Id: I63295a40aaac588f761c5964b68dbaff8d013c95 Reviewed-by: Christian Tismer <tismer@stackless.com>