[Qt-qml] Using enums in QML signal handlers
michael.brasser at nokia.com
michael.brasser at nokia.com
Wed Nov 3 06:26:19 CET 2010
Hi Olli,
This sounds like a bug -- could you please create a report at bugreports.qt.nokia.com<http://bugreports.qt.nokia.com>?
Thanks,
Michael
On 02/11/2010, at 11:06 PM, ext ext-salonen.olli at nokia.com<mailto:ext-salonen.olli at nokia.com> wrote:
Hi,
I have declared an enum in a class and use it as an argument in a signal. I can use the enum in QML, but I cannot read the parameter in the signal handler. Is it supposed to work somehow?
Example:
class MyObject {
Q_OBJECT
Q_ENUMS(MyEnum)
Q_PROPERTY(MyEnum value READ value NOTIFY valueChanged)
public:
enum MyEnum { Value1, Value2};
signals:
void valueChanged(MyEnum value);
}
Qml file
----------
MyObject {
onValueChanged: console.debug(“Value is “ + value)
}
This fails with the following output:
QMetaProperty::read: Unable to handle unregistered datatype 'MyEnum' for property 'QDeclarativeBoundSignalParameters::value'
I also tried to rename the signal parameter type to MyObject::MyEnum, but this did not work either. I can use the value correctly if I access it as a property, or if I assign enum values such as “property int myvalue: MyObject.Value1”.
Thanks,
Olli
<ATT00001..txt>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20101103/11dffae9/attachment.html
More information about the Qt-qml
mailing list