Skip to content
Permalink
Browse files

Fix mutex visibility

  • Loading branch information
elpaso committed Nov 11, 2020
1 parent 8d7f540 commit cb43bd8bd2dc26effb7880928d40b06f4985e4d4
@@ -203,6 +203,7 @@ of -1 will determine automatically (either first one currently checked or none)
%End

protected slots:

void nodeVisibilityChanged( QgsLayerTreeNode *node );

protected:
@@ -216,6 +217,7 @@ Set check state of children - if mutually exclusive




private:

QgsLayerTreeGroup( const QgsLayerTreeGroup &other );
@@ -99,7 +99,6 @@ Gets list of children of the node. Children are owned by the parent
%End



virtual QString name() const = 0;
%Docstring
Returns name of the node
@@ -318,6 +317,7 @@ Low-level removal of children from the node.

protected:


};


@@ -442,6 +442,13 @@ void QgsLayerTreeGroup::updateChildVisibilityMutuallyExclusive()
mChangingChildVisibility = false;
}

void QgsLayerTreeGroup::makeOrphan()
{
QgsLayerTreeNode::makeOrphan();
// Reconnect internal signals
connect( this, &QgsLayerTreeNode::visibilityChanged, this, &QgsLayerTreeGroup::nodeVisibilityChanged );
}

void QgsLayerTreeGroup::setItemVisibilityCheckedRecursive( bool checked )
{
QgsLayerTreeNode::setItemVisibilityChecked( checked );
@@ -206,6 +206,7 @@ class CORE_EXPORT QgsLayerTreeGroup : public QgsLayerTreeNode
void setIsMutuallyExclusive( bool enabled, int initialChildIndex = -1 );

protected slots:

void nodeVisibilityChanged( QgsLayerTreeNode *node );

protected:
@@ -228,6 +229,9 @@ class CORE_EXPORT QgsLayerTreeGroup : public QgsLayerTreeNode
*/
int mMutuallyExclusiveChildIndex = -1;

//! Sets parent to NULLPTR and disconnects all external and forwarded signals
virtual void makeOrphan() override SIP_SKIP;

private:

#ifdef SIP_RUN
@@ -240,6 +244,7 @@ class CORE_EXPORT QgsLayerTreeGroup : public QgsLayerTreeNode

QgsLayerTreeGroup &operator= ( const QgsLayerTreeGroup & ) = delete;


};


@@ -773,7 +773,7 @@ void QgsLayerTreeModel::nodeVisibilityChanged( QgsLayerTreeNode *node )
{
Q_ASSERT( node );

QModelIndex index = node2index( node );
const QModelIndex index = node2index( node );
emit dataChanged( index, index );
}

@@ -782,7 +782,7 @@ void QgsLayerTreeModel::nodeNameChanged( QgsLayerTreeNode *node, const QString &
Q_UNUSED( name )
Q_ASSERT( node );

QModelIndex index = node2index( node );
const QModelIndex index = node2index( node );
emit dataChanged( index, index );
}

@@ -114,18 +114,12 @@ class CORE_EXPORT QgsLayerTreeNode : public QObject
QList<QgsLayerTreeNode *> children() const { return mChildren; } SIP_SKIP

/**
* Removes the childrens, disconnect all their signals and sets their parent to NULLPTR
* Removes the childrens, disconnect all the forwarded and external signals and sets their parent to NULLPTR
* \return the removed children
* \since QGIS 3.16
*/
QList<QgsLayerTreeNode *> abandonChildren() SIP_SKIP;

/**
* Sets parent to NULLPTR and disconnects all signals
* \since QGIS 3.16
*/
void makeOrphan() SIP_SKIP;

/**
* Returns name of the node
* \since QGIS 3.0
@@ -299,8 +293,12 @@ class CORE_EXPORT QgsLayerTreeNode : public QObject
//! custom properties attached to the node
QgsObjectCustomProperties mProperties;

//! Sets parent to NULLPTR and disconnects all external and forwarded signals
virtual void makeOrphan() SIP_SKIP;

private:
QgsLayerTreeNode &operator=( const QgsLayerTreeNode & ) = delete;

};


@@ -101,7 +101,6 @@ void QgsLayerTreeView::setModel( QAbstractItemModel *model )
connect( mProxyModel, &QAbstractItemModel::rowsRemoved, this, &QgsLayerTreeView::modelRowsRemoved );

#ifdef ENABLE_MODELTEST
new ModelTest( treeModel, this );
new ModelTest( mProxyModel, this );
#endif

0 comments on commit cb43bd8

Please sign in to comment.
You can’t perform that action at this time.