[Qgis-developer] itemChanged signal use on a QgsComposerItem

John Gitau gkahiu at gmail.com
Wed Jan 13 02:46:39 PST 2016


Hi,

Have you tried the 'sizeChanged' signal?

Also, have a look at the QgsComposerItemWidget class, specifically this
function:
https://github.com/qgis/QGIS/blob/master/src/app/composer/qgscomposeritemwidget.cpp#L378.
It might contain some pointers for your use case.

All the best.

Regards,

John

On Wed, Jan 13, 2016 at 4:26 AM, a arias <andres.arias.u at gmail.com> wrote:

>
>
> 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
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160113/d6629035/attachment.html>


More information about the Qgis-developer mailing list