Skip to content
Permalink
Browse files

Change if/else to switch in flags

  • Loading branch information
elpaso committed Oct 29, 2020
1 parent b2e05d0 commit 5dc87337f49f45dda023e0419a416b5b0aba50d7
Showing with 31 additions and 28 deletions.
  1. +31 −28 src/app/qgslayercapabilitiesmodel.cpp
@@ -157,47 +157,50 @@ Qt::ItemFlags QgsLayerCapabilitiesModel::flags( const QModelIndex &idx ) const
}
else
{
if ( idx.column() == IdentifiableColumn )
switch ( idx.column() )
{
if ( layer->isSpatial() )
case IdentifiableColumn:
{
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable;
if ( layer->isSpatial() )
{
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable;
}
else
{
return Qt::ItemFlags();
}
}
else
case ReadOnlyColumn:
{
return Qt::ItemFlags();
}
}
else if ( idx.column() == ReadOnlyColumn )
{
if ( layer->type() == QgsMapLayerType::VectorLayer )
{
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable;
if ( layer->type() == QgsMapLayerType::VectorLayer )
{
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable;
}
else
{
return Qt::ItemFlags();
}
}
else
case SearchableColumn:
{
return Qt::ItemFlags();
if ( layer->type() == QgsMapLayerType::VectorLayer )
{
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable;
}
else
{
return Qt::ItemFlags();
}
}
}
else if ( idx.column() == SearchableColumn )
{
if ( layer->type() == QgsMapLayerType::VectorLayer )
case RequiredColumn:
{
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable;
}
else
case HiddenColumn:
{
return Qt::ItemFlags();
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable;
}
}
else if ( idx.column() == RequiredColumn )
{
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable;
}
else if ( idx.column() == HiddenColumn )
{
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable;
}
}
return Qt::ItemFlags();
}

0 comments on commit 5dc8733

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