QML, Python, Signals, and Slots Part 2

Viranch Mehta viranch.mehta at gmail.com
Mon Jun 25 02:21:21 UTC 2012


On Mon, Jun 25, 2012 at 5:32 AM, Eric Mesa <ericsbinaryworld at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20120625/1c345a02/attachment.html>


More information about the Plasma-devel mailing list