QGIS/python/gui/auto_generated/layertree/qgslayertreeview.sip.in

289 lines
7.8 KiB
Plaintext
Raw Normal View History

2017-06-08 15:37:13 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/layertree/qgslayertreeview.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2014-05-22 01:09:14 +07:00
class QgsLayerTreeView : QTreeView
{
2017-06-08 15:37:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
The QgsLayerTreeView class extends QTreeView and provides some additional functionality
when working with a layer tree.
2017-06-08 15:37:13 +02:00
2017-12-15 10:36:55 -04:00
The view updates expanded state of layer tree nodes and also listens to changes
to expanded states in the layer tree.
2017-06-08 15:37:13 +02:00
2017-12-15 10:36:55 -04:00
The view keeps track of the current layer and emits a signal when the current layer has changed.
2017-06-08 15:37:13 +02:00
2017-12-15 10:36:55 -04:00
Allows the client to specify a context menu provider with custom actions. Also it comes
with a set of default actions that can be used when building context menu.
2017-06-08 15:37:13 +02:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:class:`QgsLayerTreeModel`
2017-12-15 10:36:55 -04:00
2017-06-08 15:37:13 +02:00
.. versionadded:: 2.4
%End
2014-05-22 01:09:14 +07:00
%TypeHeaderCode
2017-06-08 15:37:13 +02:00
#include "qgslayertreeview.h"
2014-05-22 01:09:14 +07:00
%End
%ConvertToSubClassCode
2017-06-08 15:37:13 +02:00
if ( sipCpp->inherits( "QgsLayerTreeView" ) )
sipType = sipType_QgsLayerTreeView;
else
sipType = 0;
%End
public:
explicit QgsLayerTreeView( QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsLayerTreeView
%End
~QgsLayerTreeView();
virtual void setModel( QAbstractItemModel *model );
2017-06-08 15:37:13 +02:00
%Docstring
Overridden setModel() from base class. Only QgsLayerTreeModel is an acceptable model.
%End
QgsLayerTreeModel *layerTreeModel() const;
2017-06-08 15:37:13 +02:00
%Docstring
Gets access to the model casted to :py:class:`QgsLayerTreeModel`
2017-06-08 15:37:13 +02:00
%End
QgsLayerTreeViewDefaultActions *defaultActions();
2017-06-08 15:37:13 +02:00
%Docstring
Gets access to the default actions that may be used with the tree view
2017-06-08 15:37:13 +02:00
%End
void setMenuProvider( QgsLayerTreeViewMenuProvider *menuProvider /Transfer/ );
2017-06-08 15:37:13 +02:00
%Docstring
Sets provider for context menu. Takes ownership of the instance
2017-06-08 15:37:13 +02:00
%End
QgsLayerTreeViewMenuProvider *menuProvider() const;
2017-06-08 15:37:13 +02:00
%Docstring
2019-03-21 12:44:16 +10:00
Returns pointer to the context menu provider. May be ``None``
2017-06-08 15:37:13 +02:00
%End
QgsMapLayer *currentLayer() const;
2017-06-08 15:37:13 +02:00
%Docstring
Returns the currently selected layer, or ``None`` if no layers is selected.
2019-02-26 09:11:18 +10:00
.. seealso:: :py:func:`setCurrentLayer`
2019-05-07 11:24:51 +02:00
%End
void setLayerVisible( QgsMapLayer *layer, bool visible );
%Docstring
2019-07-30 10:42:07 +10:00
Convenience methods which sets the visible state of the specified map ``layer``.
.. seealso:: :py:func:`QgsLayerTreeNode.setItemVisibilityChecked`
2019-05-07 11:24:51 +02:00
.. versionadded:: 3.10
2017-06-08 15:37:13 +02:00
%End
2019-02-26 09:11:18 +10:00
void setCurrentLayer( QgsMapLayer *layer );
2017-06-08 15:37:13 +02:00
%Docstring
2019-02-26 09:11:18 +10:00
Sets the currently selected ``layer``.
If ``layer`` is ``None`` then all layers will be deselected.
2019-02-26 09:11:18 +10:00
.. seealso:: :py:func:`currentLayer`
2017-06-08 15:37:13 +02:00
%End
QgsLayerTreeNode *currentNode() const;
2017-06-08 15:37:13 +02:00
%Docstring
2019-03-21 12:44:16 +10:00
Gets current node. May be ``None``
2017-06-08 15:37:13 +02:00
%End
QgsLayerTreeGroup *currentGroupNode() const;
2017-06-08 15:37:13 +02:00
%Docstring
2019-03-21 12:44:16 +10:00
Gets current group node. If a layer is current node, the function will return parent group. May be ``None``.
2017-06-08 15:37:13 +02:00
%End
QgsLayerTreeModelLegendNode *currentLegendNode() const;
2017-06-08 15:37:13 +02:00
%Docstring
Gets current legend node. May be ``None`` if current node is not a legend node.
2017-12-15 10:36:55 -04:00
2017-06-08 15:37:13 +02:00
.. versionadded:: 2.14
%End
2017-06-08 15:37:13 +02:00
QList<QgsLayerTreeNode *> selectedNodes( bool skipInternal = false ) const;
%Docstring
Returns list of selected nodes
2017-12-15 10:36:55 -04:00
2019-02-26 19:54:09 +10:00
:param skipInternal: If ``True``, will ignore nodes which have an ancestor in the selection
2017-06-08 15:37:13 +02:00
%End
QList<QgsLayerTreeLayer *> selectedLayerNodes() const;
%Docstring
Returns list of selected nodes filtered to just layer nodes
2017-06-08 15:37:13 +02:00
%End
2017-06-08 15:37:13 +02:00
QList<QgsMapLayer *> selectedLayers() const;
%Docstring
Gets list of selected layers
%End
QList<QgsMapLayer *> selectedLayersRecursive() const;
%Docstring
Gets list of selected layers, including those that are not directly selected, but their
ancestor groups is selected. If we have a group with two layers L1, L2 and just the group
node is selected, this method returns L1 and L2, while selectedLayers() returns an empty list.
.. versionadded:: 3.4
%End
void addIndicator( QgsLayerTreeNode *node, QgsLayerTreeViewIndicator *indicator );
%Docstring
Adds an indicator to the given layer tree node. Indicators are icons shown next to layer/group names
in the layer tree view. They can be used to show extra information with tree nodes and they allow
user interaction.
Does not take ownership of the indicator. One indicator object may be used for multiple layer tree nodes.
.. seealso:: :py:func:`removeIndicator`
.. seealso:: :py:func:`indicators`
.. versionadded:: 3.2
%End
void removeIndicator( QgsLayerTreeNode *node, QgsLayerTreeViewIndicator *indicator );
%Docstring
Removes a previously added indicator to a layer tree node. Does not delete the indicator.
.. seealso:: :py:func:`addIndicator`
.. seealso:: :py:func:`indicators`
.. versionadded:: 3.2
%End
QList<QgsLayerTreeViewIndicator *> indicators( QgsLayerTreeNode *node ) const;
%Docstring
Returns list of indicators associated with a particular layer tree node.
.. seealso:: :py:func:`addIndicator`
.. seealso:: :py:func:`removeIndicator`
.. versionadded:: 3.2
2017-06-08 15:37:13 +02:00
%End
int layerMarkWidth() const;
%Docstring
Returns width of contextual menu mark, at right of layer node items.
.. seealso:: :py:func:`setLayerMarkWidth`
.. versionadded:: 3.8
%End
public slots:
void refreshLayerSymbology( const QString &layerId );
2017-06-08 15:37:13 +02:00
%Docstring
Force refresh of layer symbology. Normally not needed as the changes of layer's renderer are monitored by the model
%End
void expandAllNodes();
2017-06-08 15:37:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Enhancement of QTreeView.expandAll() that also records expanded state in layer tree nodes
2017-06-08 15:37:13 +02:00
.. versionadded:: 2.18
%End
void collapseAllNodes();
2017-06-08 15:37:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Enhancement of QTreeView.collapseAll() that also records expanded state in layer tree nodes
2017-06-08 15:37:13 +02:00
.. versionadded:: 2.18
%End
void setLayerMarkWidth( int width );
%Docstring
Set width of contextual menu mark, at right of layer node items.
.. seealso:: :py:func:`layerMarkWidth`
.. versionadded:: 3.8
2017-06-08 15:37:13 +02:00
%End
signals:
void currentLayerChanged( QgsMapLayer *layer );
2017-06-08 15:37:13 +02:00
%Docstring
Emitted when a current layer is changed
%End
2015-02-03 02:21:52 +01:00
protected:
2017-06-08 15:37:13 +02:00
virtual void contextMenuEvent( QContextMenuEvent *event );
2015-02-03 02:21:52 +01:00
void updateExpandedStateFromNode( QgsLayerTreeNode *node );
2015-02-03 02:21:52 +01:00
QgsMapLayer *layerForIndex( const QModelIndex &index ) const;
2017-06-08 15:37:13 +02:00
virtual void mouseReleaseEvent( QMouseEvent *event );
virtual void keyPressEvent( QKeyEvent *event );
2017-07-07 08:54:00 +10:00
virtual void dropEvent( QDropEvent *event );
virtual void resizeEvent( QResizeEvent *event );
protected slots:
void modelRowsInserted( const QModelIndex &index, int start, int end );
void modelRowsRemoved();
void updateExpandedStateToNode( const QModelIndex &index );
void onCurrentChanged();
void onExpandedChanged( QgsLayerTreeNode *node, bool expanded );
void onModelReset();
2017-06-08 15:37:13 +02:00
protected:
};
class QgsLayerTreeViewMenuProvider
{
2017-06-08 15:37:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Implementation of this interface can be implemented to allow QgsLayerTreeView
instance to provide custom context menus (opened upon right-click).
2017-06-08 15:37:13 +02:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:class:`QgsLayerTreeView`
2017-12-15 10:36:55 -04:00
2017-06-08 15:37:13 +02:00
.. versionadded:: 2.4
%End
2017-06-08 15:37:13 +02:00
%TypeHeaderCode
#include "qgslayertreeview.h"
%End
public:
virtual ~QgsLayerTreeViewMenuProvider();
virtual QMenu *createContextMenu() = 0 /Factory/;
2017-06-08 15:37:13 +02:00
%Docstring
2019-03-20 07:28:32 +10:00
Returns a newly created menu instance (or ``None`` on error)
2017-06-08 15:37:13 +02:00
%End
2014-05-22 01:09:14 +07:00
};
2017-06-08 15:37:13 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/layertree/qgslayertreeview.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/