[QGIS-Developer] How to Wait for layout map item to render before zoomFull

Jorge Moreira jorgealmerio at yahoo.com.br
Thu Jan 2 19:01:40 PST 2020


Hi all,
I am trying to open the layout designer with the first Layout of the project and Zoom to full, but it only works after I click the second time. I think the problem is that I am not waiting for layout map render to finish (Please see the code below)
Does anyone can help me?

Best regards,
Jorge Almerio
        
project = QgsProject.instance()         manager = project.layoutManager() layouts_list = manager.printLayouts() 
if layouts_list:            l_out = layouts_list[0]
            self.iface.openLayoutDesigner(layout=l_out)
            designer = iface.openLayoutDesigners()[0]            
            designer.window().showMaximized()
            designer.view().zoomFull()else:
            self.iface.messageBar().pushMessage("Uteis: ", self.tr('There is No Layout defined!'), level=Qgis.Warning, duration=5)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200103/e71ad2da/attachment-0001.html>


More information about the QGIS-Developer mailing list