[QGIS-Developer] My own LayoutItem not getting rendered unless ...

Patrick Dunford enzedrailmaps at gmail.com
Mon Sep 11 23:35:29 PDT 2023


Hi

You may need to put a line like this

QApplication.processEvents()

to ensure a refresh takes place of visual elements.

On 11/09/23 20:21, Raymond Nijssen via QGIS-Developer wrote:
> Hi,
>
> For a plugin I made my own type of layoutItem which renders some kind 
> of special graph. However, when the code adds the item to a layout, 
> the rectangle is there but the content does not get rendered.
>
> Now when I run this line in the console:
>
> layout_manager = QgsProject.instance().layoutManager()
>
> the layout item does get rendered, and also every next layout works 
> properly. I put the line of code just above my layout item's class 
> definition and it solves the problem. But I'd like to know if this is 
> the right approach and why this line of code is needed. (Or if this is 
> a bug?)
>
> Thanks!
>
> Raymond
>
>
>
>
>
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list