[Interest] Behaviour change of QMetaProperty::write with QSharedPointer

mail at herrdiel.de mail at herrdiel.de
Tue Sep 6 21:54:12 CEST 2016


Hi,

it seems, that from Qt 5.5.1 to 5.6 (and ever since) we have a change in 
the behaviour of QMetaProperty::write when QSharedPointer is involved.
In 5.5.1 it was possible to use

@
QVariant var;
var.setValue<QSharedPointer<BaseClass>>(value);
QMetaProperty::write(object,  var)
@

to write an Object of type QSharedPointer<DerivedClass> to an attribute 
of a QObject.
Now we need to explicitly use

@
QVariant var;
var.setValue<QSharedPointer<DerivedClass>>(value);
QMetaProperty::write(object,  var)
@

Otherwise write() will return false and the value is not set.
With simple pointers, it still works.
Is this an intended behaviour? If it works for normal pointers, it 
*should* work for shared pointers, too, I would think.

Best regards,
Sebastian

-- 
http://www.classintouch.de - Tablet-Software für Lehrer



More information about the Interest mailing list