[Ktutorial-commits] SF.net SVN: ktutorial:[331] trunk/ktutorial/ktutorial-library/src
Status: Alpha
Brought to you by:
danxuliu
From: <dan...@us...> - 2011-07-06 19:35:44
|
Revision: 331 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=331&view=rev Author: danxuliu Date: 2011-07-06 19:35:38 +0000 (Wed, 06 Jul 2011) Log Message: ----------- Fix being unable to call setProperty(QObject*, QString, QVariant) from Ruby scripts. A new method, setPropertyToWaitFor, had to be added to avoid the name clash with setProperty(QObject*, QString). Modified Paths: -------------- trunk/ktutorial/ktutorial-library/src/WaitForProperty.cpp trunk/ktutorial/ktutorial-library/src/WaitForProperty.h Modified: trunk/ktutorial/ktutorial-library/src/WaitForProperty.cpp =================================================================== --- trunk/ktutorial/ktutorial-library/src/WaitForProperty.cpp 2011-06-21 15:24:13 UTC (rev 330) +++ trunk/ktutorial/ktutorial-library/src/WaitForProperty.cpp 2011-07-06 19:35:38 UTC (rev 331) @@ -69,6 +69,12 @@ this, SLOT(checkPropertyValueToEndTheWait())); } +void WaitForProperty::setPropertyToWaitFor(QObject* object, + const QString& propertyName, + const QVariant& value) { + setProperty(object, propertyName, value); +} + bool WaitForProperty::conditionMet() const { if (!mObject) { return false; Modified: trunk/ktutorial/ktutorial-library/src/WaitForProperty.h =================================================================== --- trunk/ktutorial/ktutorial-library/src/WaitForProperty.h 2011-06-21 15:24:13 UTC (rev 330) +++ trunk/ktutorial/ktutorial-library/src/WaitForProperty.h 2011-07-06 19:35:38 UTC (rev 331) @@ -100,10 +100,28 @@ * @param propertyName The name of the property. * @param value The value of the property to wait for. */ - Q_INVOKABLE void setProperty(QObject* sender, const QString& propertyName, + Q_INVOKABLE void setProperty(QObject* object, const QString& propertyName, const QVariant& value); /** + * setProperty(QObject*, const QString&, const QVariant&) version to be used + * in Ruby scripts. + * Ruby backend calls setProperty(const char*, const QVariant&) method + * instead of the aforementioned one. This method just offers a non + * overloaded name and delegates the call in the method from + * WaitForProperty. + * + * @param object The object that contains the property. + * @param propertyName The name of the property. + * @param value The value of the property to wait for. + * @todo Remove when Ruby backend gets proper support for overloaded + * methods. + */ + Q_INVOKABLE void setPropertyToWaitFor(QObject* object, + const QString& propertyName, + const QVariant& value); + + /** * Returns true if the property has the expected value, false otherwise. * Note that it will return true even if the property got the expected value * when this WaitForProperty was inactive. That is, as long as the property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |