This commit is contained in:
Alessandro Pasotti 2020-10-23 18:01:56 +02:00
parent 246f1f5b19
commit 6aa537c778
4 changed files with 50 additions and 12 deletions

View File

@ -350,7 +350,13 @@ Updates model when node's name has changed
void nodeLayerLoaded();
void nodeLayerWillBeUnloaded();
void layerLegendChanged();
void layerFlagsChanged();
%Docstring
Emitted when layer flags have changed.
.. versionadded:: 3.18
%End
void layerNeedsUpdate();

View File

@ -14,20 +14,11 @@
class QgsLayerTreeProxyModel : QSortFilterProxyModel
{
%Docstring
*************************************************************************
qgslayertreeview.h
--------------------------------------
Date : May 2014
Copyright : (C) 2014 by Martin Dobias
Email : wonder dot sk at gmail dot com
**************************************************************************
This program is free software; you can redistribute it and/or modify *
it under the terms of the GNU General Public License as published by *
the Free Software Foundation; either version 2 of the License, or *
(at your option) any later version. *
The QgsLayerTreeProxyModel class is a proxy model for QgsLayerTreeModel, supports
hidden layers and text filtering.
**************************************************************************
.. versionadded:: 3.18
%End
%TypeHeaderCode
@ -36,12 +27,26 @@ the Free Software Foundation; either version 2 of the License, or *
public:
QgsLayerTreeProxyModel( QgsLayerTreeModel *treeModel, QObject *parent );
%Docstring
Constructs QgsLayerTreeProxyModel with source model ``treeModel`` and a ``parent``
@param treeModel
@param parent
%End
void setFilterText( const QString &filterText = QString() );
%Docstring
Sets filter to ``filterText``.
%End
bool showHidden() const;
%Docstring
Returns if hidden layers are shown.
%End
void setShowHidden( bool showHidden );
%Docstring
Determines if hidden layers are shown.
%End
protected:

View File

@ -313,6 +313,11 @@ class CORE_EXPORT QgsLayerTreeModel : public QAbstractItemModel
void nodeLayerLoaded();
void nodeLayerWillBeUnloaded();
void layerLegendChanged();
/**
* Emitted when layer flags have changed.
* \since QGIS 3.18
*/
void layerFlagsChanged();
void layerNeedsUpdate();

View File

@ -35,18 +35,40 @@ class QgsLayerTreeFilterProxyModel;
#include <QSortFilterProxyModel>
/**
* \ingroup gui
*
* The QgsLayerTreeProxyModel class is a proxy model for QgsLayerTreeModel, supports
* hidden layers and text filtering.
*
* \since QGIS 3.18
*/
class GUI_EXPORT QgsLayerTreeProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
/**
* Constructs QgsLayerTreeProxyModel with source model \a treeModel and a \a parent
* @param treeModel
* @param parent
*/
QgsLayerTreeProxyModel( QgsLayerTreeModel *treeModel, QObject *parent );
/**
* Sets filter to \a filterText.
*/
void setFilterText( const QString &filterText = QString() );
/**
* Returns if hidden layers are shown.
*/
bool showHidden() const;
/**
* Determines if hidden layers are shown.
*/
void setShowHidden( bool showHidden );
protected: