QGIS/python/gui/layertree/qgslayertreeviewdefaultactions.sip
Even Rouault 60a1701377 [FEATURE] Change of ergonomy of the visibility of layers inside groups
See https://github.com/qgis/QGIS-Enhancement-Proposals/issues/86

- Checking/unchecking a group doesn't change the check state of its children.
A node is visible if and only if it is checked and all its parents too.
- There is no more a semi-checked state for a group
- Ctrl-clic on a unchecked group will check the group and all its descendants.
- Ctrl-clic on a unchecked layer will check the lager and all its parents.
- Ctrl-clic on a checked group will uncheck the group and all its descendants.
- Ctrl-clic on a checked layer will uncheck the layer and all its parents.
- Those actions are available in contextual menu items in the tree view.
- Invisible layers because they or their parent(s) is unchecked are greyed out.
2017-01-02 13:25:25 +01:00

66 lines
2.2 KiB
Plaintext

/**
* The QgsLayerTreeViewDefaultActions class serves as a factory of actions
* that can be used together with a layer tree view.
*
* @see QgsLayerTreeView
* @note added in 2.4
*/
class QgsLayerTreeViewDefaultActions : QObject
{
%TypeHeaderCode
#include <qgslayertreeviewdefaultactions.h>
%End
public:
QgsLayerTreeViewDefaultActions( QgsLayerTreeView* view );
QAction* actionAddGroup( QObject* parent = 0 ) /Factory/;
QAction* actionRemoveGroupOrLayer( QObject* parent = 0 ) /Factory/;
QAction* actionShowInOverview( QObject* parent = 0 ) /Factory/;
QAction* actionRenameGroupOrLayer( QObject* parent = 0 ) /Factory/;
QAction* actionShowFeatureCount( QObject* parent = 0 ) /Factory/;
//! Action to check a group and all its children
QAction* actionCheckAndAllChildren( QObject* parent = nullptr );
//! Action to uncheck a group and all its children
QAction* actionUncheckAndAllChildren( QObject* parent = nullptr );
//! Action to check a group and all its parents
QAction* actionCheckAndAllParents( QObject* parent = nullptr );
QAction* actionZoomToLayer( QgsMapCanvas* canvas, QObject* parent = 0 ) /Factory/;
QAction* actionZoomToGroup( QgsMapCanvas* canvas, QObject* parent = 0 ) /Factory/;
// TODO: zoom to selected
QAction* actionMakeTopLevel( QObject* parent = 0 ) /Factory/;
QAction* actionGroupSelected( QObject* parent = 0 ) /Factory/;
//! Action to enable/disable mutually exclusive flag of a group (only one child node may be checked)
//! @note added in 2.12
QAction* actionMutuallyExclusiveGroup( QObject* parent = 0 ) /Factory/;
void zoomToLayer( QgsMapCanvas* canvas );
void zoomToGroup( QgsMapCanvas* canvas );
public slots:
void showInOverview();
protected slots:
void addGroup();
void removeGroupOrLayer();
void renameGroupOrLayer();
void showFeatureCount();
void zoomToLayer();
void zoomToGroup();
void makeTopLevel();
void groupSelected();
//! Slot to enable/disable mutually exclusive group flag
//! @note added in 2.12
void mutuallyExclusiveGroup();
protected:
void zoomToLayers( QgsMapCanvas* canvas, const QList<QgsMapLayer*>& layers );
QString uniqueGroupName( QgsLayerTreeGroup* parentGroup );
};