Commit Graph

282 Commits

Author SHA1 Message Date
Christian Stenger
e1d90a7965 QmlJS: Improve handling of user defined enums
Improves handling of Qml based enums inside qml documents.

 * completion of enums
 * follow the enum
 * highlighting values inside the declaration
 * displaying the enum declaration inside the outline
 * minor static checks

Task-number: QTCREATORBUG-19226
Change-Id: Ia07fd9a8b7fa3106f2ea53198bfdcc50eecb7307
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2024-04-15 07:56:56 +00:00
Tim Jenssen
85ea2758ac Merge remote-tracking branch 'origin/qds/dev' into 12.0
Conflicts:
	share/qtcreator/qmldesigner/connectionseditor/SuggestionPopup.qml
	share/qtcreator/themes/dark.creatortheme
	share/qtcreator/themes/default.creatortheme
	share/qtcreator/themes/flat-dark.creatortheme
	share/qtcreator/themes/flat-light.creatortheme
	share/qtcreator/themes/flat.creatortheme
	src/libs/utils/CMakeLists.txt
	src/plugins/CMakeLists.txt
	src/plugins/qmlprojectmanager/qmlproject.cpp
	src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp

Change-Id: Idd87c281e1aa7b7fd2702473ad55e18563cbfb21
2023-10-05 15:53:42 +02:00
Christian Stenger
aef5a94c22 QmlJS: Remove unused functions
Amends eb5cdb4293.

Change-Id: I8d8627b9471547df0334f6035d4a0241a21c1f1f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-09-28 07:27:36 +00:00
Olivier De Cannière
eb5cdb4293 Revert: qmljs: add check for comparisons not depending on values
The warnings produced by these checks have always been somewhat broken.
Ever since they were added people users complained about the M325
warnings because they were confusing or because of false positives.

Fixes: QTCREATORBUG-29601
Change-Id: Ifac1ed0819a05251b3c4b583627cc45553e3d680
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-09-27 12:07:35 +00:00
Thomas Hartmann
096c825084 QmlJSCheck: Do not warn about visual properties in Connections
Change-Id: I1b8d9374021d337d87025290fd025dd600fc3967
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2023-09-19 12:25:44 +00:00
Tim Jenssen
a603b65f18 Merge remote-tracking branch 'origin/11.0' into qds/dev
Change-Id: I2bf1a2a72d9765d9b4088840414b4933644db47a
2023-09-14 12:23:01 +00:00
Semih Yavuz
fd2d1ceeae Fix M16 warning restrictions
In case id is not ancestor, we cannot find that ID in m_idStack by
design. The ID of an uncle type could be either popped out or not pushed
in yet. The previous implementation, therefore, doesn't restrict M16
messages if non-ancestor ID is referred.

As a workaround, disable M16 warnings completely if the enclosing type
uses ImmediateProperties.

Amends 012f984c27

Task-number: QTCREATORBUG-28468
Change-Id: I47326e005753ff7b94057732602cfeb6dc525bbb
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-30 15:54:24 +00:00
Thomas Hartmann
0af20575c1 QmlJS: Turn ErrDoNotMixTranslationFunctionsInQmlUi into a warning
Task-number: QDS-10548
Task-number: QDS-7597
Change-Id: I785fbf0f47f0753b257ef5fae1c3bf4afa9b416f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2023-08-30 08:07:08 +00:00
Vikas Pachdha
f1b5fb6e11 Add interface to check incompatible qml ids
Task-number: QDS-10121
Change-Id: I112bee4e9323dc4eff30ec7a4693c1e9632d6ba9
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2023-07-21 09:31:43 +00:00
Semih Yavuz
012f984c27 Restrict M16 warnings
Do not warn out invalid property name if the property starts with an id
in the same component scope.

Small refactoring: Move early-return-likely elements up before any
calculations done.

Fixes: QTCREATORBUG-28468
Change-Id: I2cbdbc24af42f126db0bbd6027ebe4f96d9c199f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2023-06-27 07:21:58 +00:00
Christian Stenger
97a97b3019 QmlJS: Fix initializing static analyzer
...when using a customized analyzer that has no customization.
If there is no customization we do not store the value inside
the settings, so we get empty lists instead of the default
lists for disabled messages.
Amends 427640063e.

Change-Id: Idea560176b0a9caa93dca7a3a2d01cc3aa3a6d2f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-06-12 12:05:04 +00:00
Christian Stenger
585eb1c3e4 QmlJS: Switch default enabled state for analyzer message
This message was mainly added for the QmlDesigner and DesignStudio.
It might be a valid warning under circumstances, but it may also
prevent valid use cases.
Turn it off by default and enable it for the QmlDesigner parts.

Fixes: QTCREATORBUG-29088
Change-Id: Id2c76efdf3fa419cfce71ad89360927241d41ac8
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-06-07 10:32:06 +00:00
Christian Stenger
427640063e QmlJS: Allow disabling static analyzer messages
Provide settings to define a customized set of enabled
static analyzer messages.

Fixes: QTCREATORBUG-29095
Change-Id: Id629e383dd9e3beeef98026759ac66716dc43d23
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-05-04 10:49:07 +00:00
Tim Jenßen
feabda3aa7 Merge remote-tracking branch 'origin/10.0' into qds/dev
bigger conflicts resolved at:
  src/plugins/qmldesigner/CMakeLists.txt
  src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp

Change-Id: I08e2a109d8e37cbd77225129854e9e633725bfc7
2023-03-26 16:26:18 +02:00
Thomas Hartmann
51864d0808 QmlJS: Allow string::arg() in ui.qml files
Task-number: QDS-9037
Change-Id: Ie91e745ae4d20e0fd96df1d767fc875475a0be7a
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
2023-02-07 12:31:55 +00:00
Alessandro Portale
17b28909a9 QmlJS: Tr::Tr
Excluding the Qml parser, which needs to remain in sync with it's copy
in Qt.

Change-Id: I22f475f265dd74687e3239c4d6916c777798a447
Reviewed-by: hjk <hjk@qt.io>
2023-02-01 13:48:12 +00:00
Thomas Hartmann
49955964f7 QmlJSCheck: Add missing comma
Change-Id: I5f26cbe50ecb47c088bab8b9cdea49d0103352eb
Reviewed-by: Burak Hancerli <burak.hancerli@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2023-01-20 10:12:20 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
Artem Sokolovskii
f0556b08b8 qmljs: Remove foreach usage
Task-number: QTCREATORBUG-27464
Change-Id: Ifdb8cf514dfe328e0a64bde1beff3e63a4b7fbc3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-21 12:53:41 +00:00
Eike Ziller
5d55cfdae5 Merge remote-tracking branch 'origin/8.0'
Conflicts:
	share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml
	share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf
	src/libs/utils/fileutils.cpp
	src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp
	src/plugins/qmldesigner/designercore/include/abstractview.h
	src/plugins/qmldesigner/designercore/include/nodemetainfo.h
	src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
	src/plugins/qmldesigner/designercore/model/model_p.h
	src/plugins/remotelinux/linuxdevice.cpp
	tests/auto/utils/fileutils/tst_fileutils.cpp

Change-Id: I26a21e2523d3d725fdb8c548a531cdbdaeaeca20
2022-09-19 09:54:06 +02:00
Henning Gruendl
fbb9dd1647 QmlDesigner: Allow multiple StateGroups in .ui.qml
Change-Id: If7f626f196899ebd49e5f6393d8e3ef81447945c
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-09-13 10:05:23 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Eike Ziller
64247bf571 Merge remote-tracking branch 'origin/8.0'
Reverts/comments out parts of 45f93a817a,
which needs to be resolved in a follow-up commit.

 Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
	src/plugins/clangcodemodel/clangmodelmanagersupport.cpp
	src/plugins/cmakeprojectmanager/cmakesettingspage.cpp
	src/plugins/python/pythoneditor.cpp
	src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
	src/plugins/scxmleditor/common/colorsettings.cpp

Change-Id: I7f0f7b7120e75a9fc3a8886bc57c17345cbb501b
2022-08-19 12:48:27 +02:00
Thomas Hartmann
f31638c856 QmlDesigner: Allow Timer in ui.qml files
Change-Id: I0fbf7270f8514b212fab5aae89d2def11d6b53bd
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-08-16 15:26:37 +00:00
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