2

I am getting very difficulties to add a map canvas widget through QtDesigner. I want a window with some buttons and a space to open the map canvas. How do I specify that? What widget did I choose?

Also I want to open the OpenLayers maps (Google Maps, Bing maps, etc) to overlap in the window with vector files.

Is there any widget which combine these two forms of view?

3

Just choose a QWidget and promote it.

From PYQGIS official guide:

It can be also embedded into an existing widget or window. When using .ui files and Qt Designer, place a QWidget on the form and promote it to a new class: set QgsMapCanvas as class name and set qgis.gui as header file. The pyuic4 utility will take care of it. This is a very convenient way of embedding the canvas. The other possibility is to manually write the code to construct map canvas and other widgets (as children of a main window or dialog) and create a layout.

To do this, just right click on your placed widget and choose Promote, then set class name and header.

  • Oh, I get it!!! Thank you so much. The Promote part that's what I miss. – Bárbara Duarte Nov 24 '15 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.