[Qgis-developer] itemChanged signal use on a QgsComposerItem

a arias andres.arias.u at gmail.com
Tue Jan 12 17:26:16 PST 2016


Hi. I'm working on a plugin for the Composer, but it seems that few people
are interested in this aspect of QGIS, so I rarely get answers to my
difficulties on stackexchange (
http://gis.stackexchange.com/questions/174648/how-to-use-itemchanged-signal-to-update-data
).

I need to to call a function when I move one of the QgsComposerItems on the
composer. For example a QgsComposerLabel that is already placed on the
composer and whose variable name is *label1*, this code

def setCoordText():

    label1.setText(str(label1.x()) + "," + str(label1.y()))

label1.itemChanged.connect(setCoordText)


should show the x and y numbers of the label's new location. However this
only works if the label is moved AND then is put back with an UNDO command.
It is as if the signal is triggered by the Undo command, but not the move
itself. Can anybody help me with this? Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160112/5a1a0d73/attachment.html>


More information about the Qgis-developer mailing list