[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: QML, Python, Signals, and Slots
From:       Eric Mesa <ericsbinaryworld () gmail ! com>
Date:       2012-06-25 2:58:37
Message-ID: CAKYHq8LZNTNvga954bzCJtQ07-1iUSoaYJaE3odPW5HqwbkU5w () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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 <viranch.mehta@gmail.com>wrote:

> On Sun, Jun 24, 2012 at 8:26 PM, Eric Mesa <ericsbinaryworld@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
>
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel@kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
>
>

[Attachment #5 (text/html)]

Yup!  I just figured out your first answer on my own.  Thanks again for all your \
help!<br clear="all">--<br>Eric Mesa<div><a href="http://about.me/ericmesa" \
target="_blank">http://about.me/ericmesa</a><br><a \
href="http://www.ericsbinaryworld.com" \
target="_blank">http://www.ericsbinaryworld.com</a></div> <br>
<br><br><div class="gmail_quote">On Sun, Jun 24, 2012 at 10:32 PM, Viranch Mehta \
<span dir="ltr">&lt;<a href="mailto:viranch.mehta@gmail.com" \
target="_blank">viranch.mehta@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> <div class="im">On Sun, Jun 24, 2012 at 8:26 PM, Eric Mesa \
<span dir="ltr">&lt;<a href="mailto:ericsbinaryworld@gmail.com" \
target="_blank">ericsbinaryworld@gmail.com</a>&gt;</span> wrote:<br></div><div \
class="gmail_quote"> <div class="im"><blockquote class="gmail_quote" style="margin:0 \
0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br>Just curious about one \
thing:<br>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&#39;s \
function(int) -&gt; how do I provide the int argument for the python FROM the QML?  \
<br>

</blockquote><div><br></div></div><div>you simply declare the signal as: \
updateRequired(int number); and connect it to the slot that</div><div>accepts an \
integer.</div><div class="im"><div> </div><blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

It&#39;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&#39;t seem to make sense how that happens \
because there&#39;s no real link to it.  I kinda understand what I&#39;m doing, but \
not enough to figure out how to get the into to python.<br>

</blockquote><div><br></div></div><div>the view.rootObject() is your qml&#39;s root \
item. when you declare a signal in qml, it gets created</div><div>as a normal Qt \
signal, which you can then connect to any c++ (or in this case, python) slot.</div>

<div>yes, the signal is a function (that optionally takes arguments), which calls all \
the slots that we</div><div>connect to the signal (and the arguments are passed to \
them, if any).</div><span class="HOEnZb"><font color="#888888"><div> \
</div></font></span></div><span class="HOEnZb"><font \
color="#888888"><br><div>Viranch</div> \
</font></span><br>_______________________________________________<br> Plasma-devel \
mailing list<br> <a href="mailto:Plasma-devel@kde.org">Plasma-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/plasma-devel" \
target="_blank">https://mail.kde.org/mailman/listinfo/plasma-devel</a><br> \
<br></blockquote></div><br>



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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic