mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
- update methods of existing classes - add comment to methods missing in the sip bindings - split up collective sip files into single files and use same directory structure in python/ as in src/ - add a lot of missing classes (some might not make sense because of missing python methods in those classes) - remove some non-existing methods from the header files - add scripts/sipdiff - replace some usages of std::vector and std::set with QVector/QSet
69 lines
2.4 KiB
Plaintext
69 lines
2.4 KiB
Plaintext
/** \ingroup MapComposer
|
|
* A model that provides layers as root items. The classification items are
|
|
* children of the layer items.
|
|
*/
|
|
|
|
class QgsLegendModel: QStandardItemModel
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgslegendmodel.h>
|
|
%End
|
|
|
|
public:
|
|
|
|
enum ItemType
|
|
{
|
|
GroupItem = 0,
|
|
LayerItem,
|
|
ClassificationItem
|
|
};
|
|
|
|
QgsLegendModel();
|
|
~QgsLegendModel();
|
|
|
|
/**Sets layer set and groups*/
|
|
void setLayerSetAndGroups( const QStringList& layerIds, const QList< QPair< QString, QList<QString> > >& groupInfo );
|
|
void setLayerSet( const QStringList& layerIds );
|
|
/**Adds a group
|
|
@param text name of group (defaults to translation of "Group")
|
|
@param position insertion position (toplevel position (or -1 if it should be placed at the end of the legend).
|
|
@returns a pointer to the added group
|
|
*/
|
|
QStandardItem *addGroup( QString text = QString::null, int position = -1 );
|
|
|
|
/**Tries to automatically update a model entry (e.g. a whole layer or only a single item)*/
|
|
void updateItem( QStandardItem* item );
|
|
/**Updates the whole symbology of a layer*/
|
|
void updateLayer( QStandardItem* layerItem );
|
|
/**Tries to update a single classification item*/
|
|
void updateVectorClassificationItem( QStandardItem* classificationItem, QgsSymbol* symbol, QString itemText );
|
|
void updateVectorV2ClassificationItem( QStandardItem* classificationItem, QgsSymbolV2* symbol, QString itemText );
|
|
void updateRasterClassificationItem( QStandardItem* classificationItem );
|
|
|
|
bool writeXML( QDomElement& composerLegendElem, QDomDocument& doc ) const;
|
|
bool readXML( const QDomElement& legendModelElem, const QDomDocument& doc );
|
|
|
|
Qt::DropActions supportedDropActions() const;
|
|
Qt::ItemFlags flags( const QModelIndex &index ) const;
|
|
|
|
/**Implemented to support drag operations*/
|
|
virtual bool removeRows( int row, int count, const QModelIndex & parent = QModelIndex() );
|
|
|
|
/**For the drag operation*/
|
|
QMimeData* mimeData( const QModelIndexList &indexes ) const;
|
|
QStringList mimeTypes() const;
|
|
|
|
/**Implements the drop operation*/
|
|
bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent );
|
|
|
|
void setAutoUpdate( bool autoUpdate );
|
|
bool autoUpdate();
|
|
|
|
public slots:
|
|
void removeLayer( const QString& layerId );
|
|
void addLayer( QgsMapLayer* theMapLayer );
|
|
|
|
signals:
|
|
void layersChanged();
|
|
};
|