Commit Graph

155 Commits

Author SHA1 Message Date
Ulf Hermann 843be43f18 Merge the QtTest and Qt.test.qtestroot QML modules
There is no point in having them separate and this way the plugin can be
optional.

Fixes: QTBUG-89804
Change-Id: Ic7de35f6ee7abde4840841e17d21c2b709f6db7d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-01-12 20:58:41 +01:00
David Skoland 27bd9cab73 Standardize QJsonArray iteration
When using refs as loop variables, the clang compiler complains (with
default settings). This prevents that. Note that QJsonValueRef is used
"behind the scenes", which makes this iteration method correct.

Change-Id: I5a5f58ca8ad3887bce2009231cbae5a57c107697
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-10-28 14:44:47 +01:00
Ulf Hermann 31302761f0 QmlCompiler: Rename QmlStreamWriter
The names should start with a common prefix.

Change-Id: Ib2cc247d459d78de5f0a8ea0be73b89429154475
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-05 14:58:58 +02:00
Ulf Hermann 767dd738d3 Long live libQtQmlCompiler!
Move all the code from tools/shared into src/qmlcompiler and build a
static library from it so that we can re-use it in external tools.

Change-Id: I7c8d8e59063dc7c711f4072f103a01095e6f5997
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-05 14:58:32 +02:00
Ulf Hermann e52e7ad76e qmlplugindump: Fix handling of dependencies
Tolerate dependencies without version and don't write them into the
output anymore. No one should read them as the same info has to be
available from the associated qmldir files.

Change-Id: I5e4cd93c83cb5e874a8a6e1467461d081b1a089c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-07-08 07:46:39 +00:00
Ulf Hermann 19ea4e630c Clean up registration of QEasingCurve
We don't need to register the Type enum for both QtQml and QtQuick.
QtQml is enough. Removing this makes the whole manual value type
registration obsolete. Furthermore, we want QEasingCurve as QML_FOREIGN
as we have several classes with properties of that type. To keep it nice
and tidy, we make the uppercase-named enum holder class a separate type.

Unfortunately, the Type enums differ in one entry:
QEasingCurve::BezierSpline is called Easing.Bezier in QML. Therefore, we
need to keep the custom enum around. We can change all users in
qtdeclarative to use the name from QEasingCurve, though.

Change-Id: Ibbc78d8bbf8938e2a8722f8c09833a0c73394c3d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-05-19 08:36:04 +02:00
Ulf Hermann 789929f939 Use QTypeRevision for all versions and revisions
In many places we carry major and minor versions or revisions that are
loosely coupled to minor versions. As the Qt minor version resets now,
we need to handle these things more systematically. In particular, we
need to add a "major" part to revisions.

QTypeRevision can express the current major/minor pairs more efficiently
and can also be used to add a major version to revisions. This change
does not change the semantics, yet, but only replaces the types.

Change-Id: Ie58ba8114d7e4c6427f0f28716deee71995c0d24
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-02-03 15:22:12 +01:00
Olivier Goffart 82030ac616 Adapt to the removal of QObject::staticQtMetaObject
Qt::staticMetaObject should be used instead

Change-Id: I1e02884f0b1f07e9c51d065f11bdc51c793b7173
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-01-14 14:53:56 +01:00
Ulf Hermann e9ae201497 qmlplugindump: Fix prototype and name for composite types
Before we would always merge everything up to QObject. That would
duplicate entries between types that inherit from the same base class.

Also, when the composite type doesn't specify a module (because we just
created a component from a plain QML file), use the module URI from our
version info. As we're dumping the component we can assume it belongs to
the module we're dumping.

Change-Id: Icf9a58cfe1165f557ebbf7309251e98a0782dc33
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-15 13:20:11 +02:00
Ulf Hermann 8da8d51939 qmlplugindump: Drop defaultReachableNames
They are unused.

Change-Id: Id49720bead07e353e448d92a53c2c6aabe265d3a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-12 08:18:33 +02:00
Ulf Hermann dae5bc672e qmlplugindump: Consistently sort composite types
Previously the sorting depended on qHash(QQmlType), which hashes a
pointer to QQmlTypePrivate. That was not very useful.

Also, the defaultCompositeTypes were only populated when dumping
builtins, and only used when dumping regular types. Therefore, whenever
they were used, they were empty. We don't have to bother with that.

Change-Id: Ibfbfc7e14bee900d617bab58cbe39d05f5fe91c3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-02 11:20:05 +02:00
Ulf Hermann 8af52c803b Loosen qmlplugindump's checking of URI and major version
If not given a "--strict" argument, qmlplugindump will ignore the given
major version and only check the URI as prefix, not as exact match. This
is in line with what qmlplugindump did in version 5.13 and before.

Fixes: QTBUG-78745
Change-Id: Ib2803d47e6cb60c797fec8dfaa628278307d4cd4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-26 13:03:29 +02:00
Fabian Kosmale c734eb3a8b qmlplugindump: fix prototypeNameForComposite
We do not put the objects we encounter in defaultReachaleNames. Thus,
the check in prototypeNameForComposite will fail most of the time.
Instead, we now use the same check as in collectReachableMetaObjects
(that is, does the type belong to the module).

Then, we once again only collect the metaobjects belonging to the module
in objectsToMerge, and only dump the relevant properties from there.

Fixes: QTBUG-78744
Change-Id: I78cae1e56b6f59e277198f9bcd0d826c4e0978a7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-09-25 15:20:48 +02:00
Fabian Kosmale c763c5bbe6 qmlplugindump: Handle types reexported by QtQuick
Now that our own types are not registered with qmlRegisterType<T>() anymore,
we can use QQmlType::module to decide whether a type should be included
in the qmltypes file.

We include types with no module, to support existing user code which
still calls qmlRegisterType().

Change-Id: Iee0a132bf5b3ddcdfc222ab4b2d37a1f05b1851d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-08-22 16:13:35 +02:00
Qt Forward Merge Bot 07205972ca Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
	.qmake.conf

Change-Id: I20ad6f8a260f387a3b73566a32c35a5772b401a5
2019-07-04 13:32:18 +02:00
Qt Forward Merge Bot 97aa001da9 Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	.qmake.conf

Change-Id: Icd05d016de5b4cf9af5234cb47b5c3fd0f6a053e
2019-07-03 06:11:21 +00:00
Ulf Hermann 659b575d19 qmlplugindump: dump enums also for composite types
Change-Id: I2745d3df4fca77483313c70e5433339c444c7fd4
Fixes: QTBUG-76627
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2019-07-01 11:54:23 +02:00
Richard Weickelt 4d09813242 Move creation and management of singletons to QQmlEnginePrivate
Singleton object instances were previously managed by
QQmlType::SingletonInstanceInfo and kept in a shared storage. This caused
concurrency problems when instantiating singleton instances from different
QML engines in different threads.

This patch moves the singleton house-keeping infrastructure to
QQmlEnginePrivate and makes SingletonInstanceInfo immutable.
Singleton objects are stored in a QHash with QQmlType as the key because
the qml type id might be 0 for composite singletons. The public API of
QQmlType is extended to provide more information about singleton types so that
access to SingletonInstanceInfo is not needed.

All internal accesses of singleton objects must now take the same code path via
QQmlEnginePrivate::singletonInstance<T>() which simplifies overall usage of
singletons and scatters less implementation details throughout the code base.

Task-number: QTBUG-75007
Change-Id: I13c5fd21cac2eb7291f2cbcf2c2b504f0f51a07c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-04-24 08:43:00 +00:00
Qt Forward Merge Bot 76be4abbbc Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	src/qml/compiler/qv4codegen.cpp
        src/qml/animations/qsequentialanimationgroupjob.cpp

Change-Id: I8b76e509fd7c8599d4cef25181d790ee28edab54
2019-03-13 10:10:09 +01:00
Kai Koehne c911349b8b Fix re-dumping of composite types
Just like with 'normal' types, we don't want to include composite types
that were actually part of depending imports. So we need to remove them
from the list.

This fixes an issue with QtQuick.Controls style plugins, were so
far types from QtQuick.Controls 2 imports were re-dumped.

Change-Id: Ib099ae9cfba35218cab852d4d260369c2a652727
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-03-06 12:37:41 +00:00
Kai Koehne 073977a7a1 qmlplugindump: Make compositeTypes non-static
Change-Id: Ia4f35781ed96a347464b5e423bd7446f5a7f6752
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-03-04 13:41:19 +00:00
Sergio Martins 7e6ede9d5d Fix warnings about unused Qt containers
Fixes -Wclazy-unused-non-trivial warnings, in preparation for using
gcc/clang's warn_unused attribute in all containers.

Maintainers please check if some unused variable isn't hidding an
actual bug.

Change-Id: I83c5a11aa2328db3dce4c6c402295d86ef297c83
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-11-30 10:06:55 +00:00
Qt Forward Merge Bot 1a0b06bca7 Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I7a2b9bdb69512b2d52050d829b1b65f4fcd9d99d
2018-11-01 01:00:14 +01:00
Liang Qi 2609429d7a Merge remote-tracking branch 'origin/5.11' into 5.12
Conflicts:
	src/imports/settings/qqmlsettings.cpp
	src/quick/items/qquickwindow.cpp
	tools/qmlplugindump/main.cpp

Change-Id: I96fedbc773a110374baed79a0b7de92d65df0ed6
2018-10-29 08:10:45 +01:00
Kai Koehne 53481058c5 qmlplugindump: Hardcode QtQml and QtQuick import to 2.0
Change 8725f9873d fixed qmlplugindump to always use the current
Qt minor version for the Qt Quick and Qt Qml dependencies.

Anyhow, this is unnecessary; for the dependencies resolution only the
major type is important. Hard-coding the latest import might lead to
people unnecessarily updating the plugins.qmltypes.

Change-Id: Icc969517f268b775492f2bcc901827de64123bae
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2018-10-17 12:43:26 +00:00
Kai Koehne 7ca32bc41c qmlplugindump: Remove sigsegv handler
It's not safe to use printf and memory allocations
in a signal handler.

Task-number: QTBUG-70460
Change-Id: I2a4caf302e17992471575bd89faa505a8db4a7e3
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-10-11 08:32:16 +00:00
Kai Koehne b7f5d34602 qmlplugindump: Properly handle extension types
Extension classes do augment the primary C++ class with additional
properties that should be part of the QML type. Anyhow, they should
not be visible in the API.

The old logic tried to emulate this by making the extension
class the actual C++ type, and 'inheriting' from the normal
class by setting it in the prototype. Anyhow, this failed for
e.g. Qt3D, where there are numerous types sharing the same
extension class.

Instead, this patch fixes the issue
a) hiding the extension class metainformation itself, and
b) printing properties of the extension class as part of the
   main type.

In the QMetaObject collection phase, we now traverse the class
hierarchy using QQmlType::baseMetaObject instead of
QQmlType::metaObject.

In the generation phase, we explicitly resolve the extended type,
and dump additional properties and "DefaultProperty" information
into the main type description.

Note that the ExtendedType sets the DefaultProperty independent
of the version. Changing this would require either revisioning
the defaultProperty, or (again) splitting up the types, which
however brings other problems.

Task-number: QTBUG-70294
Change-Id: I324469152398a605fae9e5a35b619845444ac4e8
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2018-10-09 07:50:37 +00:00
Kai Koehne c481ce0789 qmlplugindump: Fix calling of qmlimportscanner on Windows
Change-Id: I16618f0858b3fa878b4255147291c011efdacfc8
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2018-10-09 07:50:25 +00:00
Kai Koehne f24b3dacd0 qmlplugindump: Mark qsigSegvHandler with Q_NORETURN
Change-Id: I4b25bbe4f777f524762e6f3f15df9fc358a46da6
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2018-09-24 06:37:07 +00:00
Kai Koehne a836aee75c qmlplugindump: Add spaces to stderr output
Change-Id: Ib24b06a3c5dcdf99306fd4ecdf79e1846e492c9b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-09-24 06:36:54 +00:00
Kai Koehne 638f80c317 qmlplugindump: Remove path for -dependencies argument
Do not print the full path passed to -dependencies in the file header.
This avoids local paths to show up in the plugin.qmltypes file, and
therefore in the Qt checkout.

Task-number: QTBUG-70264
Change-Id: I7870d7d4e30e57684c62f4e353a6bf6d72dc5faf
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-09-06 12:20:42 +00:00
Kai Koehne 8725f9873d qmlplugindump: Automatically use most up to date QtQuick version
QtQuick / QML minor version is nowadays the same as the Qt minor
version.

Change-Id: I4d7ef0b101320ee2179746c95093b62e063adba2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-08-30 13:42:37 +00:00
Shawn Rutledge 499ec43937 use nullptr consistently (clang-tidy)
From now on we prefer nullptr instead of 0 to clarify cases where
we are assigning or testing a pointer rather than a numeric zero.

Also, replaced cases where 0 was passed as Qt::KeyboardModifiers
with Qt::NoModifier (clang-tidy replaced them with nullptr, which
waas wrong, so it was just as well to make the tests more readable
rather than to revert those lines).

Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-02-26 07:13:18 +00:00
Lars Knoll 55a671ea73 Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/qml/compiler/qv4compileddata.cpp
	src/qml/compiler/qv4compileddata_p.h
	src/qml/jsruntime/qv4engine.cpp
	src/qml/jsruntime/qv4qmlcontext.cpp
	src/qml/jsruntime/qv4qmlcontext_p.h
	src/qml/jsruntime/qv4regexpobject.cpp
	src/qml/jsruntime/qv4regexpobject_p.h
	src/qml/types/qqmllistmodel.cpp
	src/quick/items/qquickanimatedimage_p.h
	src/quick/scenegraph/qsgrenderloop.cpp
	tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp

Change-Id: If20ef62b2c98bdf656cb2f5d27b1897b754d3dc0
2017-09-20 14:27:41 +02:00
Marco Benelli 9464138014 qmlplugindump: skip imports containing "private"
Skipping paths that ends with "private" is not enough.

Task-number: QTBUG-47027
Change-Id: I25af518b76f594c268db6b77dbafd343f2f57ee8
Reviewed-by: Teemu Holappa <teemu.holappa@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2017-09-08 08:42:34 +00:00
Simon Hausmann 51763b1b19 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp

Change-Id: I31375151eb239f348bec988d2d0506c2b4d9604c
2017-08-23 13:48:29 +02:00
Marco Benelli 93ff90d943 qmlplugindump: fix bug in reading command line
Task-number: QTBUG-58264
Change-Id: I317fb18d9ceb8738f2f132b8703dc1af3b17d35b
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2017-08-21 06:56:03 +00:00
Simon Hausmann 43a615e309 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/qml/compiler/qqmltypecompiler.cpp
	src/qml/jsruntime/qv4qmlcontext.cpp
	src/qml/jsruntime/qv4qobjectwrapper.cpp
	src/qml/qml/qqmlcustomparser.cpp
	src/qml/qml/qqmlimport.cpp
	src/qml/qml/qqmlimport_p.h
	src/qml/qml/qqmlmetatype.cpp
	src/qml/qml/qqmlmetatype_p.h
	src/qml/qml/qqmltypenamecache.cpp
	src/qml/qml/qqmltypenamecache_p.h
	src/qml/qml/qqmltypewrapper.cpp
	src/qml/qml/qqmltypewrapper_p.h
	src/qml/qml/qqmlvmemetaobject.cpp
	src/qml/util/qqmladaptormodel.cpp

Change-Id: Ic959d03e6f9c328fb02710d9abbb0f27cddde131
2017-08-18 11:46:11 +02:00
Mitch Curtis 2b7a9aa1c7 qmlplugindump: fix "useQApplication set but not used" build error
Change-Id: If6c3e513814a7fab62ecdf7de728939c7d61263b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-04 13:18:30 +00:00
Lars Knoll e61dca7268 Change data structures in QQmlMetaTypeData
Make sure any QQmlType stored in the meta type data
has a refcount of 1. This should now make it possible
to clean out unused types by iterating over the
list of types and removing those that have a refcount
of 1.

Some care is still needed for C++ registered types, that
will need to get one more refcount, so we don't accidentally
remove them.

Task-number: QTBUG-61536
Change-Id: Id2a18dae5ddcb815f34013f5fde1f05d2d9d0214
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-08-02 16:32:56 +00:00
Lars Knoll 49a11e8820 Use QQmlType by value
QQmlType is now refcounted, and we need to use it by
value, to control it's lifetime properly. This is
required, so we can clean up the QQmlMetaTypeData
cache on engine destruction and with trimComponentCache()

Task-number: QTBUG-61536
Change-Id: If86391c86ea20a646ded7c9925d8f743f628fb91
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-02 16:32:43 +00:00
Liang Qi b1fa22c168 Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
	src/qml/compiler/qv4ssa.cpp
	src/quick/accessible/qaccessiblequickview_p.h
	src/quick/items/qquickmousearea.cpp
	src/quick/util/qquickanimatorjob.cpp
	tools/qmlplugindump/main.cpp

Change-Id: I84474cf39895b9b757403971d2e9196e8c9d1809
2017-02-24 11:48:14 +01:00
Marco Benelli dfa468904d qmlplugindump: reports qmlimportscanner's message
Report to the user the stderr of qmlimportscanner, if needed.

Task-number: QTBUG-58930
Change-Id: Ib8ddf12cb3d18c936eb151f12991900a32175576
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-02-17 14:38:37 +00:00
Marco Benelli 12db36d8a6 qmlplugindump: import paths clean-up
Remove "qrc:/qt-project.org/imports" from the paths list passed to
qmlimportscanner.
qmlimportscanner will error out on a path that does not exist.
Since the internal qrc:/qt-project.org/imports path only exists if
the plugins are compiled in statically into qmlimportscanner, we
have to remove this path to stop it from erroring out.

Task-number: QTBUG-58930
Change-Id: I39525f2b6ff29c02b38f5f701342026dea871701
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2017-02-17 14:38:11 +00:00
Peter Varga 0ceac04beb Fix typo in qmlplugindump error message
Change-Id: Icbe18330ae665b693047f098e219c3b665be22e9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-01-31 13:55:22 +00:00
Marco Benelli bdb18b5471 qmlplugindump: add -qapp option
Some modules (ie QtChart) require a QApplication instead of the
QGuiApplication that qmlplugindump use by default.
This option let the user specify if a QApplication is needed.

Task-number: QTBUG-58264
Change-Id: I10e68d0d3eab2afad315b57fef9ce92c42e70124
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-01-31 09:55:19 +00:00
Liang Qi 60300fda46 Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	.qmake.conf

Change-Id: I9d87ed86e95b5901a86cc3aa65d7ac39b0b708c2
2017-01-14 22:17:32 +01:00
Jacques GUILLOU 321726cb5e qmlplugindump : Add a "-output" argument to specify the output file
Having only the possibility to redirect the stdout of
qmlplugindump to a file is both unconvenient and unreliable
since some plugins might write content (such as logs) to
stdout, which pollute the output.

Change-Id: I8b1d482d7674945e6145d59aea839c54600e7784
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2017-01-05 16:54:38 +00:00
Liang Qi 0e80d28aa5 Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
	src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp
	src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp
	src/qml/qml/qqmlimport.cpp
	src/quick/items/context2d/qquickcontext2dtexture_p.h
	tools/qmleasing/splineeditor.h

Change-Id: I8f6630fcac243824350986c8e9f4bd6483bf20b5
2016-12-14 19:01:23 +01:00
Marco Benelli ee347ee875 qmlplugindump: avoid warnings
Wrap all global variable in an anonymous namespace in order to avoid
compiler warnings on the uninizialized ones.

Change-Id: Ifabb790d2d76b6056d706580b9e4c0f12f5119f0
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2016-12-08 09:17:29 +00:00