From kde-panel-devel Mon Jun 25 02:58:37 2012 From: Eric Mesa Date: Mon, 25 Jun 2012 02:58:37 +0000 To: kde-panel-devel Subject: Re: QML, Python, Signals, and Slots Message-Id: X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=134059333832047 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============5206469993976360522==" --===============5206469993976360522== Content-Type: multipart/alternative; boundary=000e0cdf90f28fb10b04c34328cd --000e0cdf90f28fb10b04c34328cd Content-Type: text/plain; charset=ISO-8859-1 Yup! I just figured out your first answer on my own. Thanks again for all your help! -- Eric Mesa http://about.me/ericmesa http://www.ericsbinaryworld.com On Sun, Jun 24, 2012 at 10:32 PM, Viranch Mehta wrote: > On Sun, Jun 24, 2012 at 8:26 PM, Eric Mesa 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 > > _______________________________________________ > Plasma-devel mailing list > Plasma-devel@kde.org > https://mail.kde.org/mailman/listinfo/plasma-devel > > --000e0cdf90f28fb10b04c34328cd Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Yup!=A0 I just figured out your first answer on my own.=A0 Thanks again for= all your help!
--
Eric Mesa
http://about.me/ericmesa
http://www.ericsbinaryw= orld.com



On Sun, Jun 24, 2012 at 10:32 PM, Viranc= h Mehta <viranch.mehta@gmail.com> wrote:
On Sun, Jun 24, 2012 at 8:26 PM, Eric Mesa <eri= csbinaryworld@gmail.com> wrote:

Just curious about one thing:
1) With this framework I can get infor= mation from the python program to affect the QML (and change the button to = a blue colour).=A0 How do I get information to the python program?=A0=A0 In= other words, if I have a python function that's function(int) -> ho= w do I provide the int argument for the python FROM the QML?=A0

you simply declare the signal as: up= dateRequired(int number); and connect it to the slot that
accepts= an integer.
=A0
It's a little hard for me to figure out because this stuff is all indir= ect - in the QML the signal is referred to as if it were a function.=A0 And= the function gets the data from the signal, but it doesn't seem to mak= e sense how that happens because there's no real link to it.=A0 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= 9;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 ca= se, 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 argum= ents are passed to them, if any).
Viranch

_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


--000e0cdf90f28fb10b04c34328cd-- --===============5206469993976360522== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel --===============5206469993976360522==--