Skip to content
Permalink
Browse files

Toggle layer visibility in custom layer order panel

Fixes #33854
  • Loading branch information
elpaso committed Jan 24, 2020
1 parent 276a314 commit 9604e0007e44e917094df9de3109903f74e028cc
@@ -132,13 +132,14 @@ QVariant CustomLayerOrderModel::data( const QModelIndex &index, int role ) const

bool CustomLayerOrderModel::setData( const QModelIndex &index, const QVariant &value, int role )
{
Q_UNUSED( value ); // Toggle
if ( role == Qt::CheckStateRole )
{
QString id = mOrder.at( index.row() );
QgsLayerTreeLayer *nodeLayer = mBridge->rootGroup()->findLayer( id );
if ( nodeLayer )
{
nodeLayer->setItemVisibilityChecked( static_cast< Qt::CheckState >( value.toInt() ) == Qt::Checked );
nodeLayer->setItemVisibilityChecked( ! nodeLayer->itemVisibilityChecked() );
return true;
}
}
@@ -53,7 +53,7 @@ class GUI_EXPORT QgsCustomLayerOrderWidget : public QWidget
private slots:
void bridgeHasCustomLayerOrderChanged( bool state );
void bridgeCustomLayerOrderChanged();
//! Slot triggered when the ivsibility of a node changes
//! Slot triggered when the visibility of a node changes
void nodeVisibilityChanged( QgsLayerTreeNode *node );

void modelUpdated();

0 comments on commit 9604e00

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