Commit Graph

258 Commits

Author SHA1 Message Date
Fawzi Mohamed
fd89043de2 qmljs: (QString -> Utils::FilePath)++
convert more QString containing paths to Utils::FilePath

Change-Id: I1219d7d147993e48cfa641dc9bea72ab38c90f51
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-13 17:13:23 +00:00
Eike Ziller
3211d064e0 Merge remote-tracking branch 'origin/7.0'
Change-Id: I3da1b663a570682201afbe644d6f9299019aae21
2022-04-26 15:22:35 +02:00
Thomas Hartmann
5e75673dde QmlJsCheck: Add more ids to negative lists
Since those are QML keywords those ids can create
all kind of unexpected side effects.

Change-Id: I9ecb9b0559c57d59104aacedfca505b559de9685
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2022-04-26 12:08:22 +00:00
Fawzi Mohamed
a3b1dfd34a qmljs: correctly handle js string templates
In most cases we do want to visit the expressions in a function
template. Changing its accept0 would force those not wanting to visit
it to iterate on the templates (currently a linked list), so we add a
visit method explicitly visiting the expression in all the needed
places.

Fixes: QTCREATORBUG-21869
Change-Id: I47733544bfd32eec357810b97242608b8f7de572
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-04-22 10:43:38 +00:00
Eike Ziller
e2d5b6616a Merge remote-tracking branch 'origin/7.0'
Change-Id: I01ce83a2da66bb65af37c0ecc92372789cb85c01
2022-04-22 10:04:39 +02:00
Christian Stenger
9656eb9e7a QmlJS: Fix more invalid M325 cases
Fixes: QTCREATORBUG-27380
Change-Id: I76d1ef3d2f2a4cc9d930a006ecb3b564efea3fbc
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
2022-04-22 05:24:21 +00:00
Eike Ziller
780f5da7c4 Merge remote-tracking branch 'origin/7.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/studiowelcome/recentpresets.h
	src/plugins/studiowelcome/userpresets.h

Change-Id: Ie573b945eb28347a36ee1b3582fbd6ab0c0f866c
2022-03-28 15:10:11 +02:00
Thomas Hartmann
3b5c56bcfa QmlDesigner: Add invalid ids to QmlJSCheck
Also improving document message for exceptions.

Change-Id: I7878987ce73f5d4891ced3c702c7804b25b07eb3
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2022-03-24 11:41:53 +00:00
Fawzi Mohamed
6b270b8dc9 qmljs: correctly handle js string templates
In most cases we do want to visit the expressions in a function
template. Changing its accept0 would force those not wanting to visit
it to iterate on the templates (currently a linked list), so we add a
visit method explicitly visiting the expression in all the needed
places.

Fixes: QTCREATORBUG-21869
Change-Id: I47733544bfd32eec357810b97242608b8f7de572
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
2022-03-21 09:32:29 +00:00
Eike Ziller
45b5341cd9 Merge remote-tracking branch 'origin/7.0'
Change-Id: Iab67dffe64bee391bd921ed8832bb17b36ec861b
2022-02-14 09:58:04 +01:00
Christian Stenger
39db18f968 QmlJS: Soften strict equality check Pt III
Adapt to differences Qt5 vs Qt6.

Fixes: QTCREATORBUG-25917
Change-Id: Ieee1cf0442016c62b82bd932dd62d0dc9a78bc26
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
2022-02-11 15:44:22 +00:00
Henning Gruendl
73ae5bb1f6 QmlDesigner: Show error/warning for root reference
Show an error when an alias property references the root item directly.
Show a warning when an alias property references the root item in a
hierarchy.

Task-number: QDS-4380
Change-Id: I312fc0296e3bb2321a4d9e1113bd0cd4c1c0b8ed
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-02-07 09:25:05 +00:00
Thomas Hartmann
0e696e19fe QmlJsCheck: Allow new connection syntax in Connections
Change-Id: Ibbef3f8e8230d727d3183fa1615e0f38373a3c7f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-12-02 11:04:40 +00:00
Christian Kandeler
8f611286f7 Fix some compiler warnings
Change-Id: I9128afcf56bd47cb6627012bb6b0d13395b432ac
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-11-22 13:39:08 +00:00
Thomas Hartmann
39738dee77 QmlJS: Add error message for Component with multiple children
Component is only allowed to have a single child element, that will
be the root element of the component.

If there is no child at all we create a warning. Having no child is
temporarily required.

Change-Id: I5c0d9d9cdf1be106b20ed4f1134a973d58126498
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-11-12 20:04:19 +00:00
Christian Stenger
f686bce68f QmlJS: Soften strict equality check Pt II
Disable strict equality check for undefined values as there
are too many ways the code model just assumes "undefined" as
the information would be present at runtime only or to avoid
too complex evaluation.

Task-number: QTCREATORBUG-25917
Change-Id: I7c6da04f52ba767c4ef5c21078dc14ac4de86687
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-11-08 08:04:42 +00:00
Christian Stenger
e1a15b2db5 QmlJS: Soften strict equality check
Judging on the sense of a strict equality check depends on
different aspects. As attached properties cannot be inspected
easily and e.g. function calls cannot be evaluated as they may
have different return values for different code paths we need
to soften the check to avoid false positives.

Fixes: QTCREATORBUG-25917
Change-Id: I121335a387eb235090346162df4703d3000b7426
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-10-15 05:18:23 +00:00
Miikka Heikkinen
e0611c0cfa QmlDesigner: Add support for Component type
Component type is added to Component Library and can be dragged to
the scene. Items under the component are not shown in the scene.

Fixes: QDS-5093
Change-Id: I0c80647e73124866a8b772022a761ca6cbb545a1
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-10-05 09:10:16 +00:00
Eike Ziller
31bcc0ca2c Merge remote-tracking branch 'origin/5.0' into 6.0
Change-Id: I311d1128c6a299c1db8717a12b40393055a889bb
2021-10-05 09:13:56 +02:00
Thomas Hartmann
969d659713 QmlDesigner: Allow resolvedUrl in ui.qml files
Change-Id: I220582466ffe62392b78419b9a2f6b83cf73f9af
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
2021-09-30 08:41:57 +00:00
hjk
f46c8b5c92 Merge remote-tracking branch 'origin/5.0'
Change-Id: I9409f35cb9d1bc2e57631d2bfa3a0931ff5dd259
2021-07-21 09:18:52 +02:00
Thomas Hartmann
aba3a38a60 QmlJSCheck: Add error for mixing translation functions
Change-Id: I0f5fd2edf2d8bf13938d9e18eadada5c8c1b85f2
Reviewed-by: Tapani Mattila <tapani.mattila@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-07-20 10:36:01 +00:00
Thomas Hartmann
c395e52c2b QmlDesigner: Disallow ApplicationWindow
ApplicationWindow is not properly working in the design mode
and files using ApplicationWindow are usually not written with
the design mode in mind.

Task-number: QTCREATORBUG-25984
Task-number: QTCREATORBUG-25983
Change-Id: Ia30ec26e9078ca0a9c1da11970202983e15ce4c8
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-07-16 13:11:47 +00:00
Eike Ziller
bf5b1d714c Revert "Revert "Merge remote-tracking branch 'origin/4.15'""
This reverts commit f0a86d4510.

Reverting a merge doesn't "undo" it - the changes would be lost
forever even with subsequent merges.
So we need to revert the revert to get the changes.

Change-Id: I65928f876f4dc886561bed17c4b2aa42b388c1e3
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2021-05-07 09:07:40 +00:00
Marco Bubke
f0a86d4510 Revert "Merge remote-tracking branch 'origin/4.15'"
This reverts commit 888ca0dd20.

Reason for revert: wrong patchset

Change-Id: I1291789938601aaf606c59917ff938e3c24c78dd
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-05-06 15:30:02 +00:00
Tim Jenssen
888ca0dd20 Merge remote-tracking branch 'origin/4.15'
Conflicts:
	src/libs/sqlite/sqlitebasestatement.h
	src/plugins/qmldesigner/qmldesignerplugin.cpp

Change-Id: I0fa0a8a7feffed24c0d2bc26eca86590f1156755
2021-05-06 13:07:48 +02:00
Christian Stenger
fd64253a62 QmlJS: Suppress wrong warning
When a type is created inside a file with the same name
do not warn if the created type is namespaced.

Fixes: QTCREATORBUG-24615
Change-Id: Icb2b1a9fd1a02ee222084b676ee818eed65a7c93
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-05-06 09:31:12 +00:00
Christian Stenger
2447d1d69c QmlJS: Restrict warnings of blocks
Warn only if the block contains a var statement
as this is discouraged.

Fixes: QTCREATORBUG-24214
Change-Id: Ib96c6723e82b6ddce0b7b63f23d3408f45ae7d58
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-05-05 10:32:59 +00:00
Christian Stenger
845afb25fc QmlJS: Fix checking for case and default blocks
case and default blocks inside a switch statement are just
special statement lists which need proper handling to avoid
wrong warnings regarding using standalone blocks.

Task-number: QTCREATORBUG-24214
Change-Id: Ia682b13ed4df21c5831308193d5abaf5163bde59
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-05-05 10:32:49 +00:00
Thomas Hartmann
35118c2520 QmlJsCheck: Do not allow print as id
Task-number: QDS-4162
Change-Id: I425c75cd42c0842ead27a6c801c3a483284407ea
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-04-16 07:53:00 +00:00
Fawzi Mohamed
7015ef04b7 qmljs: add check for comparisons not depending on values
currently we mainly try to warn about primitive == null/undefined or
primitive === non primitive.
There are other that we could warn about null==null null==undefined,
but I feel that they might be triggered too much by clean code.

Change-Id: Id43d838d60a4e13f361be34e4bb38211777a081e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-02-03 14:05:16 +00:00
Fawzi Mohamed
cc00af8334 qmljs: fix qmljscheck
* fix ASTVariableReference::value: correctly get reference value type
by using either initialiser of bindingTarget (broken since a codemodel
update in 2018)
* disable warning for casting in bool to null comparison (it does not
cast, is always false)
* fix property checks (where skipped without default of readonly)
* remove non relevant checks (ErrInvalidPropertyType for lowercase  now that custom
value types are supported, and for properties called data)
* updated import version

Change-Id: I38407acf327d0f773b38dda4c02fb4d95a420851
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-02-03 14:03:44 +00:00
Eike Ziller
cf2a651c3b Make QmlJS(Tools) build with Qt5 & Qt6
Port from QStringRef to QStringView

Change-Id: I472d16f20e40ca52b8e5d481850a6bd8a1a38f3b
Reviewed-by: hjk <hjk@qt.io>
2020-09-17 09:37:23 +00:00
Thomas Hartmann
f641434ec1 QmlJSCheck: Fix crash
Task-number: QDS-2766
Change-Id: I4b0e81b8104ac35a286a318e87e95ea022ed66f6
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2020-09-14 12:21:49 +00:00
Thomas Hartmann
356acf16b8 QmlJSCheck: Workaround for ListElement
When editing QML there are false positives reported
for ListElement.

Task-number: QDS-2602
Task-number: QDS-2716
Change-Id: If3fc297d6609213448f8353e9406b3f0aaf65870
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
2020-09-03 11:22:32 +00:00
Fawzi Mohamed
1ea9d6ce87 qmljs: fix unreachable test for catch clause
Change-Id: Ica1ff034b88f06849026957c8beed2cda77badcc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-03 06:31:08 +00:00
Tim Jenssen
b8cd87dea0 Merge remote-tracking branch 'origin/qds-1.59' into 4.13
Conflicts:
	src/plugins/clangformat/clangformatplugin.cpp
	src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
	src/plugins/qmldesigner/qmldesigner.qbs

Change-Id: Ie4a0beeb9fd32ac9683f4e8769988a9c3f3e369a
2020-06-26 16:51:22 +02:00
Tim Jenssen
5a06305ffe qmldesigner: enable Transion in QmlUi files
Change-Id: I2e35e8a2dc7b946297c70fd775bd3e3366295271
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-06-26 12:38:18 +00:00
hjk
54575fe42d QmlJS: More Qt6
Mostly QRegExp, one QHash::unite.

Change-Id: Ia2816fee65b9459c0f89419161f44c38cd572c36
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-19 07:13:06 +00:00
Thomas Hartmann
afb499a138 QmlJSCheck: Add Error message for recursively instantiated type
Change-Id: I68b46a929c65fb21ee8473cda44f7de4e40009c7
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-06-04 13:45:56 +00:00
Tim Jenssen
8573623c6e QmlJS: remove unused QtQuick2 check
Change-Id: I7d613ba825a5ce3d4d8302adff9c98f751bc7ab1
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
2020-03-06 14:06:54 +00:00
Fawzi Mohamed
b09a48599e Update qmljs parser to Qt 5.15 parser
* parser side support for annotations, inline components, new UiVersion
  and all the things included in QT 5.15 parser
* SourceLocation moved from QmlJS:AST to QmlJS
* Visitors now need to handle throwRecursionDepthError
* BaseVisitor for visitors that want to override all visit

Task-number: QTCREATORBUG-23591
Change-Id: I682a30d0b08b6c929739fd0e339ef6fbde3eb630
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-03 15:31:10 +00:00
Thomas Hartmann
bbf5ff61ea QmlJSCheck: Allow animations in ui.qml files
Task-number: QDS-1613
Change-Id: I4beecff16d0b67652abbdb16945614d2497d3921
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-02-19 15:47:14 +00:00
Christian Stenger
6b492866af QmlJS: Add check for duplicated import
Add a soft check for duplicated Qml/JS imports which
adds a warning when a file contains imports that
duplicate the same URI / version or file path.

Change-Id: Ib9a1f8a90dd3cf469d90e83abc1d748901b1e353
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2019-12-16 06:28:20 +00:00
Tim Jenssen
8ebcef7b51 QmlJS: Add "Symbol, Object, Function, RegExp" to global functions
This fixes a false positive error message.

Task-number: QTCREATORBUG-22599
Change-Id: Ibdf9a3a6b1679bd11afa87ca3d5e77fcda773ce0
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-12-06 10:57:12 +00:00
Ulf Hermann
58d35f8a64 QmlJS: Update QML parser using the one from qtdeclarative 5.15
We need to do this because the new "required" keyword should be
recognized by Qt Creator.

This is not a verbatim copy of the QML parser from qtdeclarative. A few
data structures have changed that would require large scale changes in
otherwise unrelated parts of the code. For example, all Visitors need to
handle recursion depth errors now and the DiagnosticMessage only has
line and column now, no longer begin and legth.

Change-Id: Iea5b04e27b07e0cba55d64b844315af9828acbf7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-10-07 07:33:58 +00:00
Eike Ziller
8df0653bf8 Merge remote-tracking branch 'origin/4.10'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/projectexplorer/gcctoolchain.cpp
	src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp

Change-Id: Iffdf48e782a734107ea170ebb3812e997cea0e7b
2019-09-12 09:08:04 +02:00
Thomas Hartmann
4bf1474aa0 QmlDesigner: Allow transformations in Qt Quick Designer
They are passively supported and we plan better support in the future.

Change-Id: I22520335ae3dba5804ec4c8902624b4afe4254a3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-09-05 12:47:03 +00:00
Eike Ziller
8d85a7c2bc QmlJS: Fix compiler warnings
Change-Id: I94fccd913a4a06fb55acee3df974859f9a163b4f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-09-04 10:11:48 +00:00
hjk
e3b1106afa Compile fix with recent Qt dev
The reasoning in 1b4766e26c did not take into account that the scope
of QT_NO_JAVA_STYLE_ITERATORS may change over time, as done with
f70905448f6 in Qt base.

Change-Id: Ib1966ff26c4d36d5f62e149d6b45baa4aecf825d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-29 08:54:18 +00:00