PDA

View Full Version : sending signals to underlying qt code and vice versa



technoViking
1st November 2010, 04:07
Hi,

I was curious if there was any example code out there other than on Qt's website that explains how to make QML objects send signals to underlying Qt code and vice versa.

The examples on qt's website are very small and I'm still confused how its suppose to work.

wysota
4th November 2010, 10:12
Signals are sent by calling them as functions from within qml code if you really need to send them explicitly. But a good design would be if signals were sent by the C++ backend only so that QML would only handle the presentation layer.

bitflyer
9th November 2010, 13:10
I am not sure if this would work for the case you have in mind, but you can bind QML properties to Qt properties. So you don't have necessarily to send a signal to link a QML property to an Qt property, you can do it using a binding. This means you need to expose the property in Qt code as Q_PROPERTY.

See "Binding Element" at the bottom of http://doc.qt.nokia.com/4.7/propertybinding.html