[Qgis-developer] QGIS standalone app - layer tree, legend and co.
wonder.sk at gmail.com
Fri Jul 4 08:07:48 PDT 2014
On Wed, Jul 2, 2014 at 4:17 PM, Matthias Ludwig <kaotika at gmx.de> wrote:
> I'am writing a data viewer as python qgis standalone application. Is it possible to use the QgisInterface and other classes (like QgsLegendInterface) for layer handling (adding, removing, activation, etc.)?
> Cause I didn't found a way I have written my own layer model based on qts QAbstractListModel. It's working more or less, but I would prever a nativ solution if available.
QgisInterface and QgsLegendInterface will not work if you are
developing a standalone application. As Andreas suggested, if you base
your application on QGIS 2.4, you can use new layer tree classes:
QgsLayerTreeView + QgsLayerTreeModel for Qt model/view and
QgsLayerTreeGroup + QgsLayerTreeLayer classes for the actual hierarchy
that will be used by the model and view classes. There is some doxygen
documentation in the header files, but I am in the process of
preparing some blog posts about the new classes... stay tuned!
More information about the Qgis-developer