summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2025-06-25 18:31:44 +0200
committerMarc Mutz <marc.mutz@qt.io>2025-06-27 22:34:20 +0200
commit4ec8b1096cbe5f888754fcd6de2b549f67a58914 (patch)
treefbe1a03c57d34c90b40dc00cb5ad3589b0f4dd47 /src/corelib/kernel/qobject.cpp
parent13f8470167d05b1f4642f986b6a286749d294c8c (diff)
QObject: make doSetProperty() take lvalue arg by cref
... not by pointer. It makes more sense this way, since `lvalue` is always passed (unlike `rvalue`, which is passed optionally, so needs a nil state), and removes a potential error state (lvalue == nullptr) that neither the compiler nor a reader of the code now have to worry about anymore. As a drive-by, rename the argument so the local alias in the function can go away, too. Amends 39cdf431f034121353e51768b4d1fec8b0dd35dc. Pick-to: 6.10 Change-Id: I818e4fec30360c5b63b84a0f7e1e1eebdfe2cfcc Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
-rw-r--r--src/corelib/kernel/qobject.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 5a6da48d52c..46f2ad7d1c4 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -4371,10 +4371,9 @@ int QObjectPrivate::signalIndex(const char *signalName,
\overload setProperty
*/
-bool QObject::doSetProperty(const char *name, const QVariant *lvalue, QVariant *rvalue)
+bool QObject::doSetProperty(const char *name, const QVariant &value, QVariant *rvalue)
{
Q_D(QObject);
- const auto &value =*lvalue;
const QMetaObject *meta = metaObject();
if (!name || !meta)
return false;
@@ -4413,7 +4412,7 @@ bool QObject::doSetProperty(const char *name, const QVariant *lvalue, QVariant *
qWarning("%s::setProperty: Property \"%s\" invalid,"
" read-only or does not exist", metaObject()->className(), name);
#endif
- return rvalue ? p.write(this, std::move(*rvalue)) : p.write(this, *lvalue);
+ return rvalue ? p.write(this, std::move(*rvalue)) : p.write(this, value);
}
/*!