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

List:       kde-panel-devel
Subject:    Re: QML, Python, Signals, and Slots Part 2
From:       Viranch Mehta <viranch.mehta () gmail ! com>
Date:       2012-06-25 2:33:21
Message-ID: CADk4Opbv995ZzZRFtKqrHkmAkBrHUqaq9ui3ebxP9b_Cx2N1AQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Mon, Jun 25, 2012 at 5:32 AM, Eric Mesa <ericsbinaryworld@gmail.com>wrote:

>
> print connect(view.rootObject(),SIGNAL(mySignal(QString)), receiver,
> SLOT(QUrl('message.qml')))
>

You don't need this line because you've already connected QML's
messageRequired
signal to Now's appropriate slot. So just remove this line and everything
else looks fine.

In future if you're supposed to use this kind of a thing, the above line
would be correct
as follows wrt current example:

QObject.connect(rootObject, SIGNAL('messageRequired()'), now,
SLOT('emit_now()'))

(where rootObject = view.rootObject() of course)

Also, the following two lines are equivalent:

1. sender.signal.connect(receiver.slot)

2. QObject.connect(sender, SIGNAL('signal()'), receiver, SLOT('slot()'))

In the 2nd line, the parameter types should be specified in signal(...) and
slot(...) as in
C++ (if any)

Cheers,
Viranch

[Attachment #5 (text/html)]

On Mon, Jun 25, 2012 at 5:32 AM, Eric Mesa <span dir="ltr">&lt;<a \
href="mailto:ericsbinaryworld@gmail.com" \
target="_blank">ericsbinaryworld@gmail.com</a>&gt;</span> wrote:<br><div \
class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"> <div class="im"><div \
class="gmail_quote"><br></div></div>print \
connect(view.rootObject(),SIGNAL(mySignal(QString)), receiver, \
SLOT(QUrl(&#39;message.qml&#39;)))<br></blockquote><div><br></div><div>You don&#39;t \
need this line because you&#39;ve already connected QML&#39;s messageRequired</div> \
<div>signal to Now&#39;s appropriate slot. So just remove this line and everything \
else looks fine.</div><div><br></div><div>In future if you&#39;re supposed to use \
this kind of a thing, the above line would be correct</div> <div>as follows wrt \
current example:</div><div><br></div><div>QObject.connect(rootObject, \
SIGNAL(&#39;messageRequired()&#39;), now, \
SLOT(&#39;emit_now()&#39;))</div><div><br></div><div>(where rootObject = \
view.rootObject() of course)</div> <div><br></div><div>Also, the following two lines \
are equivalent:</div><div><br></div><div>1. \
sender.signal.connect(receiver.slot)</div><div><br></div><div>2. \
QObject.connect(sender, SIGNAL(&#39;signal()&#39;), receiver, \
SLOT(&#39;slot()&#39;))</div> <div><br></div><div>In the 2nd line, the parameter \
types should be specified in signal(...) and slot(...) as in</div><div>C++ (if \
any)</div><div><br></div><div>Cheers,</div><div>Viranch</div></div>



_______________________________________________
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