| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Do both variant conversions and qjsonvalue conversions.
Change-Id: I655395aa64c83ef62e8062d0820fdff437ebb156
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
|
|
|
|
|
|
|
|
|
| |
Automatically tries to convert server-side values to/from QJsonValue.
Carries on as usual when the conversion fails.
Fixes: QTBUG-92902
Change-Id: I89ae7c3bc8490223c9fab41ca513d9277483692e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.
Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.
Task-number: QTBUG-99313
Change-Id: Ife5eb4ded5b31ee3cca69ab6b6e6a94a08de32ab
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8:
auto QtContainerClass = anyOf(
expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o),
expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o));
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container',
with the extended set of container classes recognized.
Change-Id: I34d5ddf6742eda92ae291d2fd0ced98fcee92b7b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
|
|
|
|
|
|
| |
Task-number: QTBUG-105596
Change-Id: Ic6547f8247454b47baa8fffd170bbd389cfb38c6
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
|
|
|
|
|
|
|
|
|
|
| |
No transport being connected is a usual situation for a QtWebChannel
server. It just so happens when no client is connected.
Printing warnings about no transports being connected just creates spam
in the logs without any gain.
Change-Id: Ia74918112a7012437a5b6f1ed97f1c4bbd557816
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
The new API isn't limited to 10 parameters. It also does its own
parameter matching, which we use here to locate the method to be
called. I don't think that was necessary, though, because we sort the
methods to be called in order of preference.
Fixes: QTBUG-105596
Change-Id: I36b24183fbd041179f2ffffd170268620633a72b
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
License files are organized under LICENSES directory.
Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: Id704376bd7d5a127ad3e9bf09f9abedcf2b0f498
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the client is connected with an in-process transport, it can happen
that a transmitted message triggers a subsequent property change.
In that case, we need to ensure that the queued messages have already
been cleared; otherwise the recursive call will send everythig again.
Case in point: The qmlwebchannel tests fail if we don't clear the
queued messages before sending them out.
For that same reason set the client to "busy" (aka non-idle) just right
before sending out the messages; otherwise a potential "Idle" type
message will not correctly restore the Idle state.
Pick-to: 6.2
Pick-to: 6.3
Change-Id: Idc4afdd5cf4b4e03b8de8953a03d28442d74a3ab
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a client invokes a method returning a QFuture<T>, QWebChannel will
now automatically attach a continuation and send the contained result
after the QFuture<T> has finished.
[ChangeLog] Transparently handle QFuture<T> method return types
Task-number: QTBUG-92903
Change-Id: I4069d51e79447dee249bb8af52a16e4496484093
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with
move semantics, its name is misleading. Q_RELOCATABLE_TYPE was
introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE
is discouraged now. This patch replaces the last usage of Q_MOVABLE_TYPE
by Q_RELOCATABLE_TYPE in qtwebchannel. As the two are synonymous, this
patch should have no impact on users.
Task-number: QTBUG-86829
Change-Id: Ife09cad141088ce988a948ecdc5df385fdffd80a
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
|
|
|
|
|
|
|
|
| |
[ChangeLog] Make blockUpdates bindable
Task-number: QTBUG-93601
Change-Id: I7a5e06ecb3258b11988343321b78ffaab1d48dc0
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
|
|
|
|
|
|
|
|
| |
[ChangeLog][QMetaObjectPublisher] Handle per-transport client idle status
Task-number: QTBUG-92927
Change-Id: I5a06261e6dddb0fc0fae9f73b280c61cf5a2b52d
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
|
|
|
|
|
| |
Change-Id: I7b3056cb77a2b46c7ebb67221cc3eaee49a9f6e2
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
|
|
|
|
|
|
|
|
| |
[ChangeLog] Make the property update interval configurable
Fixes: QTBUG-92928
Change-Id: I0b02ae0c0879c1a3891d5807c1ff8c1f619841b2
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
|
|
|
|
|
|
|
|
|
|
|
| |
If the property is BINDABLE but lacks a NOTIFY signal, the
client will have no way to register a callback for change
notifications. Document this behavior as such.
A future patch could synthesize signals for purely BINDABLE
properties on the client side, but this needs some more thought.
Change-Id: I5e723e294dc01890956fee179fb3ba30aecf8cc1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Do not call `sender()` from a different thread. As the API documentation
indicates, that is not supported and can lead to crashes as experienced
on the CI frequently.
Instead, we now have per-thread SignalHandlers and use those to get
notified about signals and metacall events.
Moving a registered object into a different thread isn't supported once
it was registered. But the object can be deregistered, moved, and then
re-registered.
[ChangeLog] Signals from objects living in a different thread than the
QWebChannel are now handled correctly.
Task-number: QTBUG-51366
Change-Id: I1edb0694b946a494b6c0d4a8a6dc6b452dcb2c7a
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
|
|
|
|
|
|
|
| |
* The warning was that a QJsonValue reference was used when iterating over a QJsonArray
Task-number: QTBUG-91757
Change-Id: I72fefb0b1d119da565b6dd1bcbada4fa874fd94e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
|
|
|
|
|
| |
Change-Id: I46f916ad88ef7cf66d27d0549d9a66cf0e03eddc
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
|
|
|
|
|
|
|
|
| |
A change to make QByteArray and QString iterable sequences,
changed the result of QVariant::canConvert<QVariantList> to true.
Change-Id: If4c335a60fde88cd8e921314f481f41188a3d9f2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
| |
Change-Id: I46c782de038e973eae54f6f187ed606d18708c41
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
|
|
|
|
|
|
|
|
| |
Switch to new functions operating directly on QMetaType object, instead
of ints.
Change-Id: Ief0ba04f4447a5f891f8187cb0cf4250ce287311
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
| |
The deprecated QVariant(int, const void *) constructor has been
removed in qtbase. The QVariant(QMetaType, const void *) constructor
should be used instead.
Change-Id: I01a22e1334d0e8ae74be7d9c055cb092ac3d1cf6
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
|
|
|
|
|
|
|
|
|
|
| |
This method is switching on the enum QVariant::Type using values from
the enum QMetaType::Type and the compiler thinks this is not very
nice. The warning is not serious since QVariant::Type is defined in
terms of QMetaType::Type.
Change-Id: Iaff7fe1ea702c6dfc77a008283a6f07cedb2729f
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous unit test for self-contained objects only wrapped the test
object once. After wrapping, a different code path is taken which still
exhibited infinite recursion. This patch addresses both the unit test
and the infinite recursion.
To fix the problem, a boolean in the ObjectInfo struct is toggled to
indicate whether the object in question is currently being wrapped. If
that is the case, the recursing code path is skipped.
[ChangeLog][General] Fixed infinite recursion when dealing with self
contained objects.
Fixes: QTBUG-84007
Pick-to: 5.15
Change-Id: Ie0898fb5f28cec91587897835ff937672d60f2a1
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
|
|
|
|
|
|
| |
Task-number: QTBUG-84469
Change-Id: Ide3fa7a558b456354703dd7fd5ee414647e24934
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
|
|\
| |
| |
| | |
Change-Id: I6417958acf66455b993c65f51b58f15955aa95f4
|
| |
| |
| |
| |
| | |
Change-Id: Ieb3f0ef5e5b752613d664731e250dba14fb42f0a
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
QVariant::toValue<QVariantList> does not honor explicit custom converters
for a sequentially iterable container to a QVariantList. This breaks
compatibility with Qt 5.12.3 and before, where the old code path using
QVariant::toList() used the custom converter. Do the same for
QVariantMap.
This patch restores the compatibility with old code. The real fix will
target the QVariantList converter code in QtCore - this is just a hotfix
within Qt WebChannel for now.
Task-number: QTBUG-80751
Change-Id: Ic70c6a353aad43ddbaefbc6626a0af87bd0d024f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | | |
Conflicts:
.qmake.conf
Change-Id: I65d3dcf8373137f14476cf37d2d2119de006a917
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Also fix usage of text stream operators.
Change-Id: I5cca2a07a8f95d4449a528aa0e8ca98c94dda40c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This converts QObjects that are embedded inside ECMAScript objects
into the actual QObject that they represent.
For example, if an array of QObjects is passed as an argument to
a method, the method will received a QVariantList where the
items are QVariants of type QObjectStar.
Method:
void processObjects(const QVariantList &list);
Call from ECMAScript:
theObj.processObjects([qobj1, qobj2])
Prior to this patch, the method would have received a list
containing QVariantMaps with keys from the QObject EMCAScript wrapper
(e.g. __objectSignals__, __propertyCache__, etc.).
After this patch, it will receive a list containing QVariants with
QObject* inside.
QVariantMaps are converted to QObjects if they have a property
called "__QObject*__" set to true and an "id" property.
"__QObject*__" is the same identifier for retuned objects and is
now added in a toJSON method at the client.
Change-Id: I5cafcddb9df0141977a574aaed4ce7c3ea2d0767
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
|
| |/
|/|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When a method expects an argument of type QVariant, the argument should
actually contain a QVariant as opposed to the converted QVariant value.
If the converted value is given, which was the logic before this patch,
then some values may not be properly converted back to a QVariant when
the method is actually invoked (null for example).
For example, if a method signature is as follows:
Q_INVOKABLE void test(QVariant value);
And it is called from ECMAScript via WebChannel as follows:
obj.test(null)
Then the argument would have been created as type 'std::nullptr_t'
and passed into the method. This results in a QVariant with a
random type, which could cause a warning or even a segmentation fault
depending on what the type ends up as.
Instead, this patch creates the argument as a 'QVariant' which
results in the proper type when the method is invoked.
Change-Id: I3f75048da1c0f32707f6f162844de74157f0b535
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
|
|/
|
|
|
|
|
|
|
|
|
|
| |
When an object is wrapped as consequence of a property update or signal
emission, wrapResult() assigns it the parent object's list of transports.
It didn't, however, establish the reverse relation, i.e from transport
to object. This resulted in dangling pointers after client disconnects
and subsequent crashes.
This patch fixes the bug.
Change-Id: I5d20269c453902bf2883dfcab1f3ab5d0757c2cd
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
|
|\
| |
| |
| |
| |
| |
| | |
Conflicts:
src/webchannel/qmetaobjectpublisher.cpp
Change-Id: I853b8fc7270847c1a9cdd862dff278ddb2533e92
|
| |\
| | |
| | |
| | | |
Change-Id: I182d51367aed4518f5bbc247e4e517af09028f7a
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previously, QVariant::toList() was used to convert a QVariant to a
QVariantList. This only works for actual QVariantLists and QStringList,
however. This patch uses QVariant::value<QVariantList>() which works in all
cases.
A better approach would be to extract a QSequentialIterable, but QTBUG-42016
currently prevents this.
Change-Id: I732cc88a6db2ec5d990760364a9db98a52521f6b
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This implements host-side overload resolution. If a client invokes a method
by its name instead of its id, the overload resolution tries to find the best
match for the given arguments.
The JavaScript client implementation now defaults to invocation-by-name, except
when a method is invoked by its full signature. In that case, the invocation
is still performed by method id.
Change-Id: I09f12bdbfee2e84ff66a1454608468113f96e3ed
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When a new transport is accessing a previously wrapped object, we used
to send potentially outdated property values.
[ChangeLog][QWebChannel][General] Send current property values when
another transport is accessing a previously wrapped object.
Fixes: QTBUG-62388
Change-Id: I5cd5772b42c3cb9860e945bb85f77f0e3b6d6ea0
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previously, we only published the first method or signal of any given
name. We keep this behavior for the nice JavaScript notation that looks
like a normal JavaScript method call `foo.bar(...)`. When you need to
call a different overloaded method, this patch offers you to specify
the explicit signature on the JavaScript side. I.e. when we have an
object with `foo(int i)` and `foo(const QString &str, int i)`, then
on the JavaScript a call to `obj.foo(...)` will always call the first
method like before. But now you can specify the full QMetaMethod
signature and call matching methods explicitly via `obj["foo(int)"]`
or `obj["foo(QString,int)"]`.
Automatic overload resolution on the C++ side for the nice notation
cannot easily be implemented: We need to know the return value of
the called function, otherwise we cannot construct a valid
QGenericReturnArgument. Furthermore, we wouldn't be able to
differentiate between e.g. any numeric types on the C++ side, since
JavaScript only has a single `double` type internally.
[ChangeLog][QWebChannel][General] It is now possible to explicitly
call overloaded methods or connect to overloaded signals by specifying
the full method or signal signature in string form on the JavaScript
side.
Fixes: QTBUG-73010
Change-Id: I4645edee97af56fd8d126e77d70dc33ed3513deb
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
|
|\| |
| | |
| | |
| | | |
Change-Id: Ife028425ea8c14d972c2df59071a9333352af7d1
|
| |\|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Conflicts:
src/webchannel/qmetaobjectpublisher.cpp
Done-With: Arno Rehn <a.rehn@menlosystems.com>
Change-Id: I763a76cf055547c5c5e59511ded51c467d6c7526
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Fixes a crash: Previously, when a connection was closed, the transport
was not removed from the list of transports of a wrapped objects. This
was because the transport was not added to the transport-to-object map
in the first place. When a property update was pushed, the now dangling
pointer to the "old" transport caused a crash.
Change-Id: Ib980f0b874851f8f85f7a3d76d51a2c884504b96
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previously, only implicitly wrapped objects have been successfully
unwrapped. "Officially" registered objects were not, and thus could not
be passed to properties or as method arguments.
Change-Id: I6b8644ed3be8db3a66c2c1d5bc167fc33a0b4165
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
QObjects that are present in an array are already converted to
an object identifier. This does the same for variant maps, which
end up as ECMAScript objects.
This allows QObjects put into a QVariantMap to be properly
deserialized. For example, if a property is declared as such:
Q_PROPERTY(QVariantMap propName READ propName CONSTANT)
And propName is:
QVariantMap propName() const {
QVariantMap map;
map.insert("theProperty", QVariant::fromValue(someQObject));
return map;
}
The "theProperty" property will now properly refer to the object.
Change-Id: I3c6e71b860f6825a31eb337aeffa55302287c8ff
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
|
|\|
| |
| |
| | |
Change-Id: I6b83cc26dddfafe3bebe1bfb3640e2daf2d9a8fb
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously, enums declared with Q_ENUM were stringified in the
conversion to JSON and QFlags did not work at all. The conversion of
QJsonValue(int) to enum worked fine, however. This patch implements
some extra logic for detecting enums and QFlags, thus correctly
converting to and from integers.
[ChangeLog] Enum values and QFlags are now correctly converted to and
from integers in the JS interface
Fixes: QTBUG-72924
Change-Id: I23d4a1120b805201c8d450edbd990aad5ad258a2
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The warning was not meaningful, since nothing depends on the notify
signal having only zero or one argument(s).
Removing this decreases warning noise in some applications.
Change-Id: Ieb716ad9ac51296a1e17899018d4e6190043b8d5
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When an already-wrapped object was used by a secondary transport, the
mapping was not updated. This could then lead to crashes when the
transport was destroyed.
[ChangeLog][General] Fix crash when wrapped objects are
shared across multiple transports.
Task-number: QTBUG-62388
Change-Id: I3c3b7302205e10f04695f1a202325704d90950d2
Reviewed-by: Kai Dohmen <psykai1993@googlemail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A real-life use case is the session restore page in KDE Falkon or, more
generally, any kind of closeTab() method exposed to JS in a QWebEnginePage.
The approach taken in this patch will only work if the transport can also deal
with deletion during a messageReceived signal emission. Alternatively, method
invocation could be delayed via the event loop, but this would come with an
obvious performance penalty.
Change-Id: I2940f61e07c77365f6e3e7cd29463d4cb5b525a6
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
|