[Qgis-developer] How to get renderComplete painter reference
Martin Dobias
wonder.sk at gmail.com
Mon Apr 7 02:57:16 PDT 2014
Hi Jürgen
On Mon, Apr 7, 2014 at 11:42 AM, Jürgen E. <jef at norbit.de> wrote:
> Hi Nathan,
>
> On Mon, 07. Apr 2014 at 19:37:35 +1000, Nathan Woodrow wrote:
>> Both those signals are the same and work the same. The newer .connect method
>> is the better way.
>
> Maybe that was to rule out something else.
Yeah, anyway I checked again and even original Anita's statement
worked for me. This is what I did in python console:
from PyQt4.QtCore import *
class A(QObject):
def __init__(self): QObject.__init__(self)
def f(self, painter): import sys; sys.__stdout__.write("hello\n")
a = A()
iface.mapCanvas().renderComplete.connect(a.f)
when moving the map, it will output "hello" to the system console from
where I started QGIS... so problem is probably somewhere else, not
with connection itself.
> Apropos does either connect actually return True?
I have learned not to trust the return value of connect() at all, for example:
>>> QObject.connect(iface.mapCanvas(), SIGNAL("abracadabra()"), a.f)
True
I'm pretty sure map canvas cannot do this kind of magic!
Cheers
Martin
More information about the Qgis-developer
mailing list