[Qt-interest] After upgrade to Qt 4.5; setProperty() does not call setter
Bram Schoenmakers
lists at bramschoenmakers.nl
Tue Mar 17 09:52:10 CET 2009
On Monday 16 March 2009 01:14:52 Bram Schoenmakers wrote:
> Q_PROPERTY( Plasma::DataEngine::Data config READ config WRITE setConfig )
[...]
> Q_DECLARE_METATYPE( Plasma::DataEngine::Data )
>
> void Applet::someFunction()
> {
> m_engine->setProperty( "config", QVariant::fromValue( m_config ) );
> }
> This worked in Qt 4.4.3, but compiling with Qt 4.5 I don't see that
> setProperty() reaches the setConfig() in the engine. For testing purposes I
> have added an integer property and it is received fine. So it looks like it
> doesn't like the data type.
>
> I have looked if there were changes to QMetaObject between the releases,
> but couldn't find anything which would cause this behavior.
It turned out that QVariant supports QHash<QString,QVariant> since 4.5 and
there is no need to declare metatypes and use QVariant::fromValue() anymore.
In Qt 4.5, the data type I was trying to pass was considered invalid and thus
the write method of the property was not called.
Kind regards,
--
Bram Schoenmakers
What is mind? No matter. What is matter? Never mind.
(Punch, 1855)
More information about the Qt-interest-old
mailing list