Skip to content
Permalink
Browse files

snapping layer tree: do not show layers without geometry

  • Loading branch information
3nids committed Dec 15, 2016
1 parent aaeaf97 commit 63773034d62174961908e5e6720e60d0fd35489d
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/app/qgssnappinglayertreemodel.cpp
@@ -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;
}

0 comments on commit 6377303

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