Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
snapping layer tree: do not show layers without geometry
  • Loading branch information
3nids committed Dec 15, 2016
1 parent aaeaf97 commit 6377303
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/qgssnappinglayertreemodel.cpp
Expand Up @@ -321,7 +321,10 @@ bool QgsSnappingLayerTreeModel::nodeShown( QgsLayerTreeNode* node ) const
{
QgsMapLayer* layer = QgsLayerTree::toLayer( node )->layer();
if ( layer && layer->type() == QgsMapLayer::VectorLayer )
return true;
{
QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( layer );

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Dec 15, 2016

Member

Better use qobject_cast, it's just a tiny bit faster and also works without RTTI.

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Dec 15, 2016

Member

Actually, there's not much point in checking layer->type() and dynamic_cast or qobject_cast. Just one of the two checks should be ok.

QgsVectorLayer* layer = qobject_cast<QgsVectorLayer*>( QgsLayerTree::toLayer( node )->layer() );
return layer && layer->hasGeometryType();

This comment has been minimized.

Copy link
@3nids

3nids Dec 15, 2016

Author Member

thanks for the hint

This comment has been minimized.

Copy link
@3nids

3nids Dec 15, 2016

Author Member

fixed in 86afa4e

return vl && vl->hasGeometryType();
}
}
return false;
}
Expand Down

0 comments on commit 6377303

Please sign in to comment.