| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The QtQml library should hold the builtins and provide no plugin. Move
the types currently exposed in QtQml.Base to QtQml where it makes sense.
Anonymous object types as well as sequence types and value types can
well be exposed as builtins. This makes everybody's life easier since
you now can universally depend on their availability.
The Qt object, despite being a named object type, also becomes a builtin
because you always have the "Qt" member of the JavaScript global object
which holds the same thing. So, formally exposing "Qt" as builtin
doesn't really add anything new.
QQmlLoggingCategory is split up into two classes, not only because we
need the base class when printing to the console from QtQml, but also
because this paves the way for compile time identification of logging
categories as first argument to the console methods.
For QQmlLocale we have to refer to a different trick. The value type and
the QQmlLocale "namespace" have to be builtins, but the "Locale" name,
due to being uppercase and versioned, has to be part of QtQml. We
transform QQmlLocale into a struct so that we can inherit the enums from
QLocale and extend a namespace with it in QtQml.
Pick-to: 6.8
Fixes: QTBUG-119473
Fixes: QTBUG-125765
Change-Id: Ica59390e54c473e33b4315f4384b724c870c1062
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
| |
Task-number: QTBUG-117983
Change-Id: I5790f01d614cd70c7fcc9bd817ec6ace3f3e3730
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
| |
Both things are not methods, and of course can not be used as such.
Change-Id: Iadaa0841ff627ad6705c66f50e7ee57aa93fb042
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
| |
Composite types don't readily expose their metaobjects because they are
expensive to create. We can use the property caches instead.
Change-Id: Idd5cc96d22489b9d0868d3955bf373c479e17c69
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
The methods that populate a default-constructed value type
should be called "populateValueType" and they don't have to
unconditionally destroy the old value.
Change-Id: Icbc0b4bccf00bb9d0f6c838239ac23a1ec9367aa
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
We want a version that only casts using the first C++ metaobject, and
another one that takes the full QML type hierarchy into account.
Change-Id: Ie23cf774f7837955de63d5ccb6c7cead1d1948f2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
and guard against null gadgetPtr. This is what we get for uninitialized
value type properties.
Pick-to: 6.5 6.5.2 6.6
Fixes: QTBUG-114494
Change-Id: I86ad23abcc4fec219017d1aad6b7add1c9a9af5d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
VariantObject as source for value type constructions should work the
same way as other types.
Pick-to: 6.5 6.6
Change-Id: I35770adf0486b404673ee00800fb1d3e429a23cf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since we allow any object to be used for property-by-property
construction when encoded as QJSValue, we should do the same when it's
encoded as QVariant.
This allows us to use typed modelData in delegates. The modelData's type
only has to be a structured value. Any matching data from the model will
then be inserted.
Fixes: QTBUG-113752
Pick-to: 6.5 6.6
Change-Id: I200e9acac3c6c302c9dedf8e7e1ccd6c9fdf5eb6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this change, qmlobject_cast was actually slower than qobject_cast
for the QQuickItem case.
Fix this by basically doing the same check (but using reinterpret_cast
instead of static_cast, as we can only forward declare QQuickItem in
qqmlgobal_p.h.
Change-Id: If98c3047d897671af7d73640e0d523ad7dd3d27a
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Qt 6 implementation of qmlobject_cast simply accessed the metaObject
of the object (canConvert -> QQmlMetaObject::QQmlMetaObject(QObject*)
-> QOject:metaObject). That would directly cause the creation of
dynamic meta-objects, if they weren't created so far.
Given that we still didn't get rid of the property-cache in QML, use it
to optimize this code path:
If the object has some associated QQmlData, retrieve it and check if we
have a property cache. If we do, retrieve the first C++ meta object
from it. We can safely ignore any dynamic meta-objects as T must be a
static meta-object. Then do the normal inheritance check with the first
C++ meta-object and T::staticMetaObject.
If we don't have a property cache, fall back to the previous
implementation (but without the QQmlMetaObject detour).
Change-Id: Ie23d1a3dac6bf343ee2bc31e04c4592681ad9995
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows us to do the relevant conversions in a more civilized way,
dropping the outputVariantConversion() method. The latter is brittle
because you have to manually add it to each instruction, and it uses
QMetaType::convert() which is actually not guaranteed to give the same
results as a QML type coercion.
Task-number: QTBUG-94807
Change-Id: I4d6d05a60beb3b4dfc3da6f0142de25667510904
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
We can actually produce an uninitialized but pre-allocated QVariant
using QVariant::Private. Using the new in-place construction support in
QMetaObject, we can minimize the amount of copying necessary for value
types.
Fixes: QTBUG-108789
Change-Id: I6b748794a6adbf6558e1e3086eab80fcfb3154a0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
You can now enable and disable the AOT-compiled code and the loading and
saving of .qmlc files separately.
Fixes: QTBUG-101358
Change-Id: I1305c4f2f75d8cff544a127e956589d1ed1aeb52
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We allow value types to be created
1. by calling Q_INVOKABLE constructors
2. by setting their values from properties of a JS object
Both have to be opted into by setting a class info. If opted into, these
options override the existing methods. When a a type can be created by
setting its properties, that implies you can also initialize it using an
invokable constructor. However, when given a JS object, the properties
method is used.
We keep this internal and undocumented for now. As the last try (the
create(QJSValue) methods and QJSValue ctors) was not that stellar, let's
first wait a bit and see if we're getting it right this time around.
Fixes: QTBUG-106480
Change-Id: I767230924afcba032d501846cc3263dad57b7bf0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
|
|
|
|
|
|
|
|
|
| |
The only thing we still need is createValueType(). That is by itself
debatable, and it can be static.
Change-Id: Id092f547415c600b7d1db01f78661c287e7f4979
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.
Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
|
|
|
|
|
|
|
|
|
| |
We should not include qqmlglobal_p.h just for the export macros as that
pulls in a number of other things. Rather, include qtqmlglobal_p.h for
that.
Change-Id: Iecb60ef676dd880c0d94360ccef6517ef1ec73bf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
Using zero as a pointer value is a legacy from the times before
nullptr got standardized.
Change-Id: I57a94e16a5b735c0faad1c0f4ff60faa9f23b4ce
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
This saves us some ping-pong between the IDs and the QMetaTypes, and
avoids possible ambiguities if multiple metatypes are registered for the
same C++ type.
Change-Id: I81cec94a9cd05d69927dc884f65574f0ab2ddc22
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Quite obviously, the Qt object is a singleton, extended with a
namespace, backed by a member of the JavaScript global object.
Defining all the methods as JavaScript functions is unnecessary and
duplicates the general type transformation code. Also, it makes it
hard to use those same methods from a C++ context as we cannot
properly set up the arguments outside the JS engine.
Rewriting the Qt object reveals some deficiencies in the old
implementation that we need to fix now:
1. The enums of the Qt type were listed as properties of the Qt object,
which means you could iterate them with a for..in loop in in JavaScript.
This is just wrong. Enums are not properties. This functionality
is deleted and the test adapted to check for each enum value separately.
The commit message for the change that introduced the iterability
already mentioned that the author had failed to find any occurrence of
this in the real world.
2. Parsing time objects from strings was done by parsing the string as a
date/time and then picking the time from that. We still support that for
now, but output a (categorized) warning. Parsing the time directly is
preferred where possible.
3. Previously you could create (invalid) dates and times from various
kinds of QML types, like int and color. This does not work anymore as we
now validate the types before calling the functions.
4. Passing more arguments to a function than the function accepted was
unconditionally ignored before. Now, a Q_CLASSINFO on the surrounding
class can specify that the arguments should be checked, in which case a
JavaScript error is thrown if too many arguments are passed. In order
for this to work correctly we also have to ignore JS undefined values as
trailing arguments for overload resolution. This way, if a method
matching the defined arguments exists, it will be preferred over a
method that matches the full argument count, but possibly cannot accept
undefined as parameter.
Consequently a number of error messages change, which is reflected in
the qqmlqt test.
[ChangeLog][QtQMl][Important Behavior Changes] You can not iterate the
enumerations of the Qt object in JavaScript anymore. This does not work
with any other enumeration type either. You can of course still access
them by name, for example as Qt.LeftButton or similar.
[ChangeLog][QtQMl][Important Behavior Changes] The time formatting
functions of the Qt object in QML now allow you to pass an actual time
string, rather than a date/time string as argument. Passing a date/time
string results in a warning now.
[ChangeLog][QtQml][Important Behavior Changes] Functions in the Qt
object for formatting date and time will now throw a JavaScript error
when presented with a value of an incompatible type, such as int or
color.
[ChangeLog][QtQml][Important Behavior Changes] The Qt.resolvedUrl()
function now returns a URL rather than a string. This follows the
documentation.
[ChangeLog][QtQml][Important Behavior Changes] The GlobalColor enum of
the Qt namespace is not exposed to QML anymore. It did not make any
sense before as the enum values could not be used as colors.
Change-Id: I7fc2f24377eb2fde8f63a1ffac5548d652de7b12
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
As properties of the Qt object they need to be visible.
Change-Id: Ic6357b92f4fae36240e8dbce8976eeb6f9f41bf0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
As you can extend value types with QML_EXTENDED we may as well allow a
factory function in the extended type. Furthermore, if the original type
allows construction from QJSValue, we may just use that. In turn, we can
get rid of the value type providers now.
Change-Id: I9124ea47537eab6c33d7451080ab2fff942eaa7b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
| |
They all did the same thing.
Change-Id: I7661b19ad16c0713d46c4df337899e3897349b2e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
It was only used for QColor. The string representation of QColor was
funneled through the color provider to get a numerical RGBA value and
that one was passed to storeValueType() which would create a QColor
object. The RGBA value was retrieved by creating a QColor object. We
can just directly create the QColor from the string, and we can use the
generic create() method for that.
Change-Id: If36775830882237e5e36f748872ce23530c3bb71
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
| |
This can be expressed as constructing the variant from a QJSValue.
Change-Id: I3140958469423acdc498e26129e349bcfb601198
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
| |
It can be expressed as a special case of create() with a QJSValue.
Change-Id: I7342026ad694077d2780dd8a852714fa72dd68d0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
| |
This can be expressed in terms of create().
Change-Id: Id1950390bf4a1c9dfd9364ea351b81c75eb7e28f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
This is so that we can replace them with factory functions as a next
step.
Change-Id: Ic8619e4e779bd3e47471642c556601555758697b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
You can now have an extension object on a value type that offers
additional properties. This is how we model the QtQuick value types. It
allows us to retrieve the extension's metaobject without using the
virtual functions in the value type provider.
As before, this mechanism is still rather dangerous and not fit for
public consumption. It relies on the extension object having exactly the
same layout as the original value type, and it hides any properties the
original value type might expose.
Furthermore we enforce now that gadgets should have lowercase names.
The ones that didn't before are split up into an anonymous value type
and a namespace that contains all the addressable bits.
Task-number: QTBUG-82443
Change-Id: Ic93d6764538d6ccc0774b3c5648eee08ba0939c0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
We can create, compare, convert registered types without going through
special virtual value type providers.
Change-Id: I0431256540b8dd6861ff3a945570ea7df45ed98d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
| |
The more adventurous variant/string conversions are luckily unused.
Let's remove them before anyone gets ideas.
Change-Id: I6f95cbdf9ead12ab723cafdbb2b0f02a0ff461fa
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Introduces an easy way to get a version of a color with transparency
(e.g. Qt.alpha("red", 0.5)).
[ChangeLog][QML][General] Added Qt.alpha for easily modifying a color's alpha value
Task-number: QTBUG-77635
Change-Id: Ic724e5fa503ca2ae5157a99eed1b5c913a39239f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Just do the typical
do {
[..stuff..]
} while(0)
in the macros
Fix the places that didn't have semicolons.
This should eliminate some compiler warnings complaining about
excessive semicolons
Change-Id: I6b0e7a55badfd0f80c3cd0e9e1da42dc41945485
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
|
|
|
|
|
|
|
| |
The old-style casts generate warnings wherever these macros are used.
Change-Id: I5427c6f476728bcf4b2b91196c10187d2aaf5a44
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
| |
Change-Id: I59f738402d51e39188bbbca2ef1fbc8a61612372
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
This is just an alias for QV4::ReturnedValue. We can as well use the
latter.
Change-Id: Ibd2c038a3ca726b39a8f0f05e02922adb9fccbdb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
| |
I want to be able to read the code.
Change-Id: I063143ff63b0a476d783c892e1d328e7f5133fab
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
| |
We will need them for the QML language server. Also, always build all of
QQmlDirParser. The QT_CREATOR condition is mostly useless.
Change-Id: I476864b55f6ff3953c11e7887525a043a9405e00
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
clang-tidy -p compile_commands.json $file -checks='-*,modernize-use-default-member-init,readability-redundant-member-init'
-config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' -header-filter='qtdeclarative' -fix
Change-Id: I705f3235ff129ba68b0d8dad54a083e29fcead5f
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When building Qt with -fsanitize undefined, the usage of
QQml_setParent_noEvent caused the following error message:
"qqmlglobal_p.h:233:5: runtime error: downcast of address
0x60300061bf10 which does not point to an object of type
'QQmlGraphics_DerivedObject'".
Instead of casting to the referred type, use QObjectPrivate::get to
access the d_ptr.
Change-Id: I2f2224bdb20a8d2e35a3291961378231f03c4ba2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This exposes QGuiApplication::platformName() for qml. It is
required at least for tests that are run on the "offscreen" platform
(armv7 tests on qemu).
[ChangeLog][QtQuick] Added Qt.platform.pluginName property.
Task-number: QTBUG-60268
Change-Id: Ie55a282485d4d76ffe7ed8e77359ad7183f579c2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
Instead use QT_CONFIG(foo). This change actually detected a few
mis-spelled macros and invalid usages.
Change-Id: I06ac327098dd1a458e6bc379d637b8e2dac52f85
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/
Updated license headers to use new LGPL header instead of LGPL21 one
(in those files which will be under LGPL v3)
Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
|
|
|
|
|
| |
Change-Id: Ifd9fe32b80cd1ebc8dc9fda7c252ecdaae42cb37
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Where possible, use qEnvironmentVariableIsSet()/
qEnvironmentVariableIsEmpty() instead of checking on the
return value of qgetenv().
Where the value is required, add a check using one of
qEnvironmentVariableIsSet()/Empty().
Change-Id: Ia8b7534e6f5165bd8a6b4e63ccc139c42dd03056
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
|
|
|
|
|
|
| |
Task-number: QTBUG-48594
Change-Id: Ifc207938de7f0c8995fc712df92665f222612647
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
|
|
|
|
|
|
|
| |
After the removeal of the QQmlVMEVariant there is no user left.
Change-Id: I97224127aac57aba9a80827f9292018d03609b85
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
|
|
|
|
|
|
|
|
|
| |
The ValueTypeProvider system allows non-QML modules to add new basic
QML types. It needs to be changed when porting away from QQmlVmeVariant
as underlying type of properties.
Change-Id: I2b52d7e6f578647a39832896c28553404b9a679f
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
|