<div dir="ltr"><div dir="ltr"><div>I believe I got this working by making the mapLayers a member of the dialog rather than a variable created in show(). For anyone who is curious or runs into this in the future, this commit worked for me:</div><div><br></div><div>  <a href="https://github.com/ebrelsford/qgis-map-canvas-test/commit/3bf48449aaf8430d03dad58c54a80c227c2852c1">https://github.com/ebrelsford/qgis-map-canvas-test/commit/3bf48449aaf8430d03dad58c54a80c227c2852c1</a></div><div><br></div><div>eric<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 22, 2019 at 7:42 PM Eric Brelsford <<a href="mailto:ebrelsford@gmail.com">ebrelsford@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>I'm unsuccessfully trying to use a QgsMapCanvas in a python plugin's dialog.</div><div><br></div><div>The  canvas renders the map, which appears and disappears the first time I load the dialog. The second time I load the dialog, the map is rendered and remains. However, I've only accomplished this by using waitWhileRendering(), which I know is incorrect.<br></div><div><br></div><div>I have posted a minimal plugin on GitHub (<a href="https://github.com/ebrelsford/qgis-map-canvas-test/" target="_blank">https://github.com/ebrelsford/qgis-map-canvas-test/</a>) demonstrating this issue. It was created using Plugin Builder. The relevant parts will be the .ui file:</div><div><br></div><div>  <a href="https://github.com/ebrelsford/qgis-map-canvas-test/blob/master/map_canvas_test_dialog_base.ui#L15" target="_blank">https://github.com/ebrelsford/qgis-map-canvas-test/blob/master/map_canvas_test_dialog_base.ui#L15</a></div><div><br></div><div>and the dialog python file:</div><div><br></div><div>  <a href="https://github.com/ebrelsford/qgis-map-canvas-test/blob/master/map_canvas_test_dialog.py#L55" target="_blank">https://github.com/ebrelsford/qgis-map-canvas-test/blob/master/map_canvas_test_dialog.py#L55</a><br></div><div><br></div><div>Is anyone familiar with what I'm doing wrong here? Or does anyone know python plugins using QgsMapCanvas in the dialog that I could use as a reference? I'd appreciate any thoughts you have on it!</div><div><br></div><div>eric<br></div></div></div></div></div>
</blockquote></div>