[Qgis-developer] Create groups in python plugins
Andres Manz
manz.andres at gmail.com
Mon Nov 23 04:09:14 EST 2009
Hi list,
While implementing QgsLegendInterface for the Python API, I ran into
another problem: QgsLegend inherits from QTreeWidget, which inherits
from QObject. As QgsLegendInterface should have signals and slots, it
should inherit from QObject, too. When QgsLegend implements
QgsLegendInterface, I get the diamond problem: Both,
QgsLegendInterface and QTreeWidget inherit from QObject. How should I
handle that? Up to now, there are three possibilities:
1. QgsLegendInterface inherits from QTreeWidget and QgsLegend only
implements QgsLegendInterface. Not a very nice solution, and the
members of QTreeWidget would be exposed to the python scripter.
2. QgsLegendInterface is a "wrapper" class for QgsLegend. It holds a
pointer to the QgsLegend and inherits from QObject.
3. Split up QgsLegend, so the part that doesn't inherit from
QTreeWidget could implement QgsLegendInterface. QgsLegend is a huge
class, so it would be a lot of work to do that.
Do you have any other solutions? Or could you recommend one of the above?
Regards
Andres
More information about the Qgis-developer
mailing list