diff options
author | Marc Mutz <[email protected]> | 2025-06-22 22:56:30 +0200 |
---|---|---|
committer | Marc Mutz <[email protected]> | 2025-06-26 06:16:31 +0200 |
commit | 56709e812c2ebb3d7f942508947ac7b0394d71ce (patch) | |
tree | b872e5420e1305cc56ae4dfb31ba8da776ff9103 | |
parent | d796624c5696f3ba8bb52016695bedf8d0218e1f (diff) |
QGuiApplication: use the rvalue overload of QObject::setProperty()
Said overload was added in 39cdf431f034121353e51768b4d1fec8b0dd35dc,
and its use prevents a forced detach in setProperty() that comes from
the function taking a copy of the QVariant and then calling .data()
on it. The rvalue overload prevents this.
Pick-to: 6.10 6.9 6.8
Change-Id: I4f84dae61ab0091d1058c9dee5a02c09b0ac41b5
Reviewed-by: Thiago Macieira <[email protected]>
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 7e448aa6ae1..7a35f4c1845 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1396,9 +1396,9 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString const qsizetype equalsPos = argument.indexOf(u'='); const QByteArray name = equalsPos != -1 ? argument.left(equalsPos).toUtf8() : argument.toUtf8(); - const QVariant value = + QVariant value = equalsPos != -1 ? QVariant(argument.mid(equalsPos + 1)) : QVariant(true); - nativeInterface->setProperty(name.constData(), value); + nativeInterface->setProperty(name.constData(), std::move(value)); } } } |