Skip to content
Permalink
Browse files

Toggle layer visibility in custom layer order panel

Fixes #33854
  • Loading branch information
elpaso authored and nyalldawson committed Jan 24, 2020
1 parent 92397e8 commit e0dbd330e134a82736c563de2d6da9e36f01b0be
@@ -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 e0dbd33

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