QML, Python, Signals, and Slots
Viranch Mehta
viranch.mehta at gmail.com
Mon Jun 25 02:32:42 UTC 2012
On Sun, Jun 24, 2012 at 8:26 PM, Eric Mesa <ericsbinaryworld at gmail.com>wrote:
>
> Just curious about one thing:
> 1) With this framework I can get information from the python program to
> affect the QML (and change the button to a blue colour). How do I get
> information to the python program? In other words, if I have a python
> function that's function(int) -> how do I provide the int argument for the
> python FROM the QML?
>
you simply declare the signal as: updateRequired(int number); and connect
it to the slot that
accepts an integer.
> It's a little hard for me to figure out because this stuff is all indirect
> - in the QML the signal is referred to as if it were a function. And the
> function gets the data from the signal, but it doesn't seem to make sense
> how that happens because there's no real link to it. I kinda understand
> what I'm doing, but not enough to figure out how to get the into to python.
>
the view.rootObject() is your qml's root item. when you declare a signal in
qml, it gets created
as a normal Qt signal, which you can then connect to any c++ (or in this
case, python) slot.
yes, the signal is a function (that optionally takes arguments), which
calls all the slots that we
connect to the signal (and the arguments are passed to them, if any).
Viranch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20120625/9c979b1b/attachment.html>
More information about the Plasma-devel
mailing list