summaryrefslogtreecommitdiffstats
path: root/src/tools/uic
Commit message (Collapse)AuthorAgeFilesLines
* uic: Add pass to empty functionsCristián Maureira-Fredes2020-03-031-6/+13
| | | | | | | | | | | | When there are no translations on the UI file, the function was left empty but without a 'pass' statement, generating a SyntaxError, this change includes it to avoid problems while using the generated Python file. Fixes: PYSIDE-1234 Change-Id: I30482a95c95fb4b4f4456531946a79c960d76318 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* uic: handle header tag for python importsCristián Maureira-Fredes2020-02-271-0/+2
| | | | | | Fixes: PYSIDE-1233 Change-Id: Id2b6e2a8b833da6ea4417d06643b2f7b045515a9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* uic/Python: Add imports for Q(Date)Time, QKeySequenceFriedemann Kleint2020-02-061-4/+4
| | | | | | | | | Those types are used as properties of Q(Date)TimeEdit, QKeySequenceEdit. Fixes: PYSIDE-1215 Change-Id: I8b9ffebb8229fff447aa7dd6bee6e037d708333c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* uic/Python: Set form object name correctlyFriedemann Kleint2020-02-051-1/+1
| | | | | | | | Add missing "not" for the isEmpty() check. Fixes: PYSIDE-1210 Change-Id: I3798d483df9d077300ff69dc5d3a8d08812f534e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* uic/Python: Fix missing QCursor importFriedemann Kleint2020-01-141-1/+1
| | | | | | Fixes: PYSIDE-1182 Change-Id: I1ccc524a152ea75508166f3d2c0c60f8d829cd8f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* uic: add customwidget imports support for pythonCristián Maureira-Fredes2020-01-141-4/+22
| | | | | | Fixes: QTBUG-81073 Change-Id: I29659481b14927ffcb8f2cb1829b577a67e4b937 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* uic: setWeight replace semi-colon by language::eolCristián Maureira-Fredes2020-01-051-1/+1
| | | | | Change-Id: I87f9c2896cfd6f83f683cf731e4a62aef627d69c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* uic: Add handling of resources imports for PythonFriedemann Kleint2020-01-034-0/+40
| | | | | | | | | | | The Python-bases pyside2-uic would write an import for each resource file encountered, adding a "_rc" suffix. Add this handling. Task-number: PYSIDE-1171 Task-number: PYSIDE-1170 Change-Id: I870d61ca7262c0684de5359a5f990d23a4171032 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* uic: Add colon missing for "if()" constructs in PythonFriedemann Kleint2020-01-031-5/+10
| | | | | | Task-number: PYSIDE-1169 Change-Id: I63c5305b0ddad1c4fcd585b65c3c78c05b40bac1 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* uic: Fix empty strings for PythonFriedemann Kleint2020-01-033-7/+9
| | | | | | | | Introduce a constant in the language namespace. Fixes: PYSIDE-1174 Change-Id: Ic3e58580b20c1d9a6ddf97f20709a3046d4b6f0c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* uic: Rename raise() to raise_() for PythonCristián Maureira-Fredes2019-12-191-2/+2
| | | | | | Fixes: QTBUG-80791 Change-Id: Ia6339b8c683147456cdffa7f2d45972e8eacd92c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* uic: Add language::eol in more cases for python codeCristián Maureira-Fredes2019-10-251-18/+18
| | | | | Change-Id: I0ab4b37399d3fba6d27cf90cab22676a3c599e5a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Uic: fix crash when trying to resource icon informationChristian Ehrlicher2019-10-211-1/+1
| | | | | | | | | | Fix a typo introduced in be56db2c49be02fd7083c5a02131462748e29bef to avoid a crash when a pixmap is given for selected on but not for selected off. Fixes: QTBUG-79125 Change-Id: I84072b6b4e8a4d21684be21f5bff1deeaddbba6d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* uic: Avoid use of Q_UNUSED in the generated codehjk2019-07-301-2/+3
| | | | | | | | | | | | | | | | | | | Instead, use (void)x; directly. The current use of Q_UNUSED(x); generates warnings for an empty statement the expansion of Q_UNUSED contains a semicolon already. Emitting Q_UNUSED(x) without the extra semicolon would be an option, too, but as the future of Q_UNUSED's embedded semicolon seems unclear right now, avoid its use altogether. The change affects only generated code that's barely ever read by a human, so the overall utility of "improved readability" of Q_UNUSED in that place is questionable anyway. Change-Id: I332527ed7c202f779bd82290517837e3ecf09a08 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* uic: Implement form window setting to disable QObject::connectSlotsByName()Friedemann Kleint2019-07-024-1/+20
| | | | | | Task-number: QTBUG-76375 Change-Id: I16ad147366aa7d52b7a0e17ae240127d8ac34b3c Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* uic: Fix remaining clang warningsFriedemann Kleint2019-06-285-18/+13
| | | | | | | | Fix remaining nullptr and member initialization issues which Qt Creator did not catch. Change-Id: If5492259aea9849c790f00809a27f4c78b446b9b Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* uic: Add option to disable the call to QObject::connectSlotsByName()Friedemann Kleint2019-06-281-0/+5
| | | | | | | | | The code was actually there, but not connected to the command line parser. Task-number: QTBUG-76375 Change-Id: I801cf2bbd2f207a6ce1dabd1ee1dfbd892089bbc Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* uic: Fix some clang warningsFriedemann Kleint2019-06-064-12/+9
| | | | | | | | | | | | | | | | | | | | - Use range-based for - Use isEmpty() instead .size(), streamline code - Fix warnings about class definitions, use Q_DISABLE_COPY_MOVE and '= default' for trivial constructors Change-Id: I76255fd9d80c3faffebda9a438e86e918c16d289 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* uic: Replace 'typedef' by 'using'Friedemann Kleint2019-06-064-10/+10
| | | | | | | | | | | | | | | | | Apply Fixits by Qt Creator with some amendments. Change-Id: I152cb5935ff7d649de297b010b9253c625c7da84 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* uic: Introduce nullptrFriedemann Kleint2019-06-115-11/+10
| | | | | | | | | | | | | | | | | Apply Fixits by Qt Creator. Change-Id: Ic2d65b2604d1d71d910773e02bcdf2466f49e52c Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Remove QLatin1Literal usagesGiuseppe D'Angelo2019-06-101-1/+1
| | | | | | | | | | | | | That's an undocumented Qt 4/3/2 remnant, start remove usages. Fix incorrect include header in qclass_lib_map.h as a drive-by. Change-Id: I939be2621bc03e5c75f7e3f152546d3af6d37b91 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* uic/Python: Fix tab stop/Z-Order and buddy handlingFriedemann Kleint2019-05-084-42/+52
| | | | | | | | | | | | | | | | | | | | | | | | The code compared the attribute names of the properties against the m_registeredWidgets hash which contained the qualified names (self.widget) and thus reported errors without actually generating anything. Replace the m_registeredWidgets hash by a lookup of the attribute name in the m_widgets hash and add a function widgetVariableName() returning the qualified variable name for an attribute name and use that for the checks. Remove unused m_registeredActions hash and rename some variables to make it clearer. Task-number: PYSIDE-797 Change-Id: Id31d95c1141d21c51eb85bcd8f8fc63486eb36a5 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* uic/Python: Generate empty strings as "" instead of QString()Friedemann Kleint2019-05-081-2/+4
| | | | | | Task-number: PYSIDE-797 Change-Id: I4ce12ba01318e5ed7e88178dfd2450d9fe78c708 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Deprecate conversion functions between QList and QSetLars Knoll2019-05-071-1/+1
| | | | | | | | | | Users should use range constructors instead to do the conversion. Keep conversion methods between QList and QVector as these will turn into a no-op in Qt 6, whereas forcing people to use range constructors would lead to deep copies of the data. Change-Id: Id9fc9e4d007044e019826da523e8418857c91283 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Prefix textstream operators with Qt::Lars Knoll2019-05-021-5/+5
| | | | | | | As the non prefixed variants are deprecated Change-Id: I2ba09d71b9cea5203b54297a3f2332e6d44fedcf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* uic: Fix missing Python import for QFontComboBoxFriedemann Kleint2019-04-241-1/+3
| | | | | | | | It requires QFontDatabase from QtGui. Add more classes from QtGui. Fixes: PYSIDE-994 Change-Id: Ib84c86e2305fad60560a3f12997eb1e46deb67cb Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* uic: Do not generate Q_UNUSED for PythonFriedemann Kleint2019-04-161-1/+1
| | | | | | Task-number: PYSIDE-797 Change-Id: Id269af024c03c2c586d440659bb6c49c3d6eedc6 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* uic: Port WriteInitialization::writeBrush() be able to generate PythonFriedemann Kleint2019-04-121-19/+27
| | | | | | Task-number: PYSIDE-797 Change-Id: I7c4e204a5ac9be2dee8f06c38323a15a0372fe5c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* uic: Refactor WriteInitialization::writeIconProperties() and add PythonFriedemann Kleint2019-04-121-43/+64
| | | | | | | | | Unfold the function with returns to reduce nesting and add language handling. Task-number: PYSIDE-797 Change-Id: Ie6c47745b118d75c0bb2c9eea7d52c8f0377f1a6 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* uic: Fix enum values for PythonFriedemann Kleint2019-04-083-77/+109
| | | | | | | | Add a helper for replacing "::" by "." for Python. Task-number: PYSIDE-797 Change-Id: I017d430b0b8b2ffbbd3300d583603924fee4d479 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* uic: Port method calls to pythonFriedemann Kleint2019-04-083-128/+228
| | | | | | | | | Use the language helper for dereferencing pointers and end of line. Task-number: PYSIDE-797 Change-Id: Icbca9015f2a3e8800ad4a56edf8fef9ee43f4528 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* uic: Adapt connection syntax to PythonFriedemann Kleint2019-04-054-18/+59
| | | | | | | | | | Extend WriteInitialization::findDeclaration() to return the class name (on this occasion preparing for generating Qt 5 connection syntax) and add a helper function for formatting the connection. Task-number: PYSIDE-797 Change-Id: I7507f604c8275c93d347b7a6a5d5b5a2a5f3ffd5 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* uic: Add qualification with "self." for PythonFriedemann Kleint2019-04-052-5/+12
| | | | | | | | | Prepend "self." (this) to the name stored in the class Driver's hashes as specifying it is mandatory in Python. Task-number: PYSIDE-797 Change-Id: I1da110b84b2d1131ee6af915f9cc4ba21d7de710 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* uic: Add pythonFriedemann Kleint2019-04-0513-48/+630
| | | | | | | | | | | | - Add command line option - Add import (include) handling - Add language helpers like streamable classes for Function definition, object instantiation - Implement header comment formatting Task-number: PYSIDE-797 Change-Id: I15041ab16504ea159f6665781a829cd548585af1 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* uic: Refactor string constant formattingFriedemann Kleint2019-04-054-117/+226
| | | | | | | | | Refactor the fixString() helper, moving the code into a streamable class using a helper which can be used for different encodings. Task-number: PYSIDE-797 Change-Id: I0f82945b6b334da8524882dda2f104327eba79d4 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-031-3/+3
|\ | | | | | | Change-Id: I99a27f9a0402e1ccad45a2d062d784f8d9a08dd3
| * Fix remaining Q_DECL_OVERRIDE instancesAllan Sandfeld Jensen2019-04-021-3/+3
| | | | | | | | | | Change-Id: I512ea5a6c8cf2928b276af7f83f00a1df5879595 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | uic: Refactor reverse name lookupFriedemann Kleint2019-04-023-27/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a helper routine to look up the dom classes by attribute name and change Driver::widgetByName() and Driver::actionByName() to use that as does Driver::actionGroupByName() (all these functions are called with names from the XML files). Remove the name normalization in WriteInitialization::findDeclaration() and refactor WriteInitialization::acceptActionRef() to call findOrInsert() to correctly use the unique name. Task-number: PYSIDE-797 Change-Id: I34058361964719c442182faf798f055f11b40412 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-03-161-1/+1
|\| | | | | | | Change-Id: Ief0a0b754c104d5348fee9ee15e967bd37c526f8
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-151-1/+1
| |\ | | | | | | | | | Change-Id: I2bf3b4ceb79364330eae4cbf3cdee9a82d1be46d
| | * uic: write out min/maximumSectionSize property before current sizeChristian Ehrlicher2019-03-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since faff43348bfae5cfc709fabe9d2698fc3063c050 the min/maxSectionSize is respected when setting the current/default section size programatically. This is not honored when writing out the properties and therefore the default section size is not correctly set when it's smaller then the default minimum section size. Therefore make sure to set min/maxSectionSize property before all other properties. Fixes: QTBUG-74352 Change-Id: I8f9ede3e90b7c9c65f8440953b00e1d9d6006d38 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* | | More nullptr usage in headersKevin Funk2019-03-141-2/+2
|/ / | | | | | | | | | | | | | | | | | | | | Diff generated by running clang-tidy's modernize-use-nullptr checker on the CMake-based Qt version. Skipping src/3rdparty, examples/, tests/ Change-Id: Ib182074e2e2fd52f63093f73b3e2e4c0cb7af188 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | uic: Fix broken icon code generationFriedemann Kleint2019-01-231-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Change b86d0b62156993936bf93169a895a92ad60adf7d rearranged the sequence of function calls when generating code adding QTabWidget and QToolBox pages, not taking into account that the iconCall() has a side effect (writing out icon definition) Revert that part and add a comment. Fixes: QTBUG-72980 Task-number: PYSIDE-797 Change-Id: Ie8fbaa36f21cd4408fb1f491195da5c260708e6c Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* | uic: Refactor CustomWidgetsInfo::extends()Friedemann Kleint2019-01-105-42/+75
| | | | | | | | | | | | | | | | | | | | | | | | Add a extendsOneOf() helper that takes a QStringList to be searched and simplify the code accordingly. In WriteInitialization::acceptWidget(), move the variable CustomWidgetsInfo *cwi up and reuse everywhere to shorten code. Task-number: PYSIDE-797 Change-Id: I331e135b6aa58dbbd413ca151eb67b3eb92f09c6 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-12-151-1/+18
|\| | | | | | | Change-Id: Iad06d8c07dfc288c9d1a9f7ee3520285cea60546
| * uic: Generate version check macros around newly introduced palette color roleFriedemann Kleint2018-12-141-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | Change ebd3a13b807c6af2684b42d3912549caf7ef82aa introduced a new QPaletter::PlaceholderText color role which causes the uic-generated code not to compile when using Qt Designer embedded in Qt Creator with older (5.9 LTS) kits. Generate a version check macro to fix this. Change-Id: I6d9f7edb0c6047c2f64ef3357b29f91655c52aac Fixes: QTBUG-72555 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* | uic: Refactor DOM class lookup in class DriverFriedemann Kleint2018-12-133-61/+54
| | | | | | | | | | | | | | | | | | Change the API to take const Dom * classes and use a helper function to do the insertion. Task-number: PYSIDE-797 Change-Id: I079f5c92bae85d6246c14077db06e381b572cda5 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* | uic: No longer generate static_cast for enum values in legacy formsFriedemann Kleint2018-12-133-24/+111
| | | | | | | | | | | | | | | | | | Add a lookup for the affected enum values and use the names instead. Task-number: PYSIDE-797 Change-Id: I6be166409000aff83d9465c9a3b2f37b44c5c085 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* | uic: Small refactoringsFriedemann Kleint2018-12-127-120/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Do not use QString::number() to stream numbers. - Do not use QLatin1String/Char to stream strings or characters. - Add a convenience methods to determine the container page add method for simple containers. - Similarly, extract a method to determine the layout method and simplify the code accordingly. - Fix Clang warnings about else if after return/continue. - Use QString::isEmpty() instead of size() to check emptiness. - Fix QHash-contains()/value() Antipattern Task-number: PYSIDE-797 Change-Id: I9c61d20f46c8d142b947126a27faaf54b41f9e0c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* | Use Q_DISABLE_COPY_MOVE for private classesFriedemann Kleint2018-12-122-2/+2
| | | | | | | | | | Change-Id: I3cfcfba892ff4a0ab4e31f308620b445162bb17b Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>