[Qt-interest] After upgrade to Qt 4.5; setProperty() does not call setter

Bram Schoenmakers lists at bramschoenmakers.nl
Mon Mar 16 01:14:52 CET 2009


Hello,

A problem arised with my code after upgrading to Qt 4.5. It is about setting a 
property with setProperty().

So I have this class:

==========
#include <Plasma/DataEngine>

class FlickrEngine : public Plasma::DataEngine
{
  Q_OBJECT

  Q_PROPERTY( Plasma::DataEngine::Data config READ config WRITE setConfig )
public:
  FlickrEngine( QObject *p_parent, const QVariantList &p_args );
  ~FlickrEngine();

  Plasma::DataEngine::Data config() const;
  void setConfig( const Plasma::DataEngine::Data &p_config );
[...]
};
==========

Where Plasma::DataEngine is a typedef of QHash< QString, QVariant >.

>From another component I do the following:

==========
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.

I hope someone has an idea what exactly is going wrong here.

Thanks in advance,

-- 
Bram Schoenmakers

What is mind? No matter. What is matter? Never mind.
(Punch, 1855)




More information about the Qt-interest-old mailing list