Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #34015 from elpaso/bugfix-gh33854-custom-layer-ord…
…er-toggle

Toggle layer visibility in custom layer order panel
  • Loading branch information
elpaso committed Jan 24, 2020
2 parents 276a314 + 9604e00 commit e083988
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/gui/layertree/qgscustomlayerorderwidget.cpp
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/layertree/qgscustomlayerorderwidget.h
Expand Up @@ -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();
Expand Down

0 comments on commit e083988

Please sign in to comment.