diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-08-03 17:55:11 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-08-04 15:46:02 +0000 |
commit | 64a560d977a0a511ef541d6116d82e7b5c911a92 (patch) | |
tree | 704115319f973cddc0683178cd9b66ce7d76cd2c /src | |
parent | 4c223502787f604fc8e726b0f9006c868810c08d (diff) |
QObject: do allow setProperty() to change the type of the property
[ChangeLog][QtCore][QObject] Fixed a bug in setProperty() that caused a
property change not to take effect if the old value compared equal using
QVariant's equality operator, but the values were not strictly equal.
Task-number: QTBUG-69744
Change-Id: I00e04a465fcf4fc1a462fffd1547885861a07a64
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 566f75a6c3..c6fe787e03 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3898,7 +3898,8 @@ bool QObject::setProperty(const char *name, const QVariant &value) d->extraData->propertyNames.append(name); d->extraData->propertyValues.append(value); } else { - if (value == d->extraData->propertyValues.at(idx)) + if (value.userType() == d->extraData->propertyValues.at(idx).userType() + && value == d->extraData->propertyValues.at(idx)) return false; d->extraData->propertyValues[idx] = value; } |