qtdeclarative/tools
Ulf Hermann ecf78f3190 QmlCompiler: Properly handle uncertain component status
In order to determine whether an ID is visible from a referrer we need
not only determine the component boundaries of the referrer, but also
those of the candidate elements with the respective ID. Rewrite the
logic to have QQmlJSScopesById handle this. It has to iterate the
respective elements anyway and can therefore easily check if one of them
is assigned to an unknown property. It now provides low-level methods
that output all possible candidates for an ID, while also stating the
confidence associated with them. The plain id() and scope() methods only
return results we are actually certain about.

In places where we generate warnings or can allow for some fuzzy
results, we use the low-level methods, since those generally produce
more informative results.

The QML DOM was passing the JavaScript global object as referrer to the
scope() method before. This happened to work but was, of course, wrong.
Make sure that ID elements in the DOM receive a proper QML scope to
avoid that.

Pick-to: 6.10 6.9 6.8
Task-number: QTBUG-140041
Change-Id: I41cf8603ae6a5d5461d3c12d74521e68b5e28ea4
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-09-18 23:24:23 +02:00
..
qml Adjust to QUnifiedTimer slow mode changes 2025-06-27 19:27:12 +08:00
qmlaotstats aotstats: Fix coverity warnings 2024-11-07 20:06:01 +01:00
qmlcachegen CMake: Fix installation of qmlcache's .prf files in cross-builds 2025-01-03 11:57:39 +01:00
qmlcontextpropertydump qmlcontextpropertydump: add tool for context property search 2025-08-22 08:12:40 +02:00
qmldom DOM refactoring. Remove LoadOptions 2024-01-30 17:14:09 +01:00
qmleasing Remove Qt keywords from all headers 2022-12-09 11:55:10 +08:00
qmlformat Add security header for src/qmlformat 2025-09-17 08:52:47 +00:00
qmlimportscanner qmlimportscanner: Optionally add version to output again 2025-07-08 11:50:09 +02:00
qmljs QtQml: Don't use loadModule in qmljs 2025-06-18 08:05:17 +02:00
qmljsrootgen Expose XMLHttpRequest to qmltypes 2025-07-22 10:18:31 +02:00
qmllint qmllint: don't search for heuristic context properties 2025-08-25 16:10:21 +00:00
qmlls qmlls: add --version command line parameter 2025-04-23 07:36:04 +01:00
qmlplugindump QtQml: Hold QQmlTypeLoader in QV4::ExecutionEngine 2025-06-17 07:00:33 +02:00
qmlpreview Remove Qt keywords from all headers 2022-12-09 11:55:10 +08:00
qmlprofiler qmlprofiler: Fix data sorting 2024-01-25 18:35:05 +01:00
qmlscene Adjust to QUnifiedTimer slow mode changes 2025-06-27 19:27:12 +08:00
qmltc QmlCompiler: Properly handle uncertain component status 2025-09-18 23:24:23 +02:00
qmltestrunner CMake: Force-build qmltestrunner when cross-compiling 2025-06-17 18:44:38 +02:00
qmltime Remove all QML_DECLARE_TYPE from src and tools 2023-11-18 07:37:33 +00:00
qmltyperegistrar qmake: Don't pass empty foreign-types list to qmltyperegistrar 2025-02-25 19:46:08 +01:00
svgtoqml svgtoqml: Don't output full file path in comment 2025-09-11 20:00:47 +02:00
CMakeLists.txt qmlcontextpropertydump: add tool for context property search 2025-08-22 08:12:40 +02:00