qgis / qgis4.0_api

Tracker for QGIS 4.0 API related issues and developer discussion
3 stars 1 forks source link

QgsComposition requires a QgsMapSettings object #4

Closed nyalldawson closed 7 years ago

nyalldawson commented 8 years ago

Aside from causing crashes (see https://hub.qgis.org/issues/11077), this restriction causes a lot of API pain (eg https://github.com/qgis/QGIS/blob/master/src/core/composer/qgscomposerlegend.cpp#L111 ). It's also a big limitation in that it prevents having different CRSes for different composer maps.

It's going to be a significant task to rework the composer API to avoid this.

m-kuhn commented 7 years ago

I am not sure if I completely get the picture of this...

Is the problem that the composition would like to work on the same map settings as the canvas does and cannot use canvas because it is in gui?

For QField I have developed a MapSettings object that does all the map settings management. It does not do any gui stuff and just emits notifications for changes to map settings internals. At any point a copy of the current state can be taken (to start a rendering job etc).

Basically it allows for working on a shared QgsMapSettings object for several components. Not sure if that's what required here but it could potentially be nice for composer, server, ...

https://github.com/opengisch/QField/blob/master/src/mapsettings.h

wonder-sk commented 7 years ago

A composition is just a page layout, so there is no reason to require a map settings object attached to it... there can be any number of maps in a composition - or there may be no map at all...

nyalldawson commented 7 years ago

Gone in https://github.com/qgis/QGIS/commit/5e17403f1a0b2bc6d168ad71eece6ea3d896c35b