0

I'm using QGIS 2.18 and I'm printing maps using a QGIS plugin I made myself. The method setItemPosition(x, y) is working fine with my legend (QgsComposerLegend object).

But when I try to use the same method setItemPosition(x, y) with a piece of text (QgsComposerLabelobject), it doesn't do anything and my text remains in the upper left corner of the composition :

enter image description here

As you can see above, all my 5 labels are stuck in the upper left corner of the picture, while my idea was to put the 5 labels in 5 different places, using a for loop in Python.

Additional relevant info :

  • My paper size is (260, 200)
  • I used label.setItemPosition(150, 50) as a test, so the labels should be placed around the middle of the picture.
2
  • Have you considered upgrading to the latest LTR?
    – Erik
    Commented Apr 20, 2020 at 12:46
  • @Erik unfortunately my company is using a lot of QGIS 2 plugins, some of which proved not to be compatible with QGIS 3, which is why I'm sticking to QGIS 2 Commented Apr 20, 2020 at 12:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.