Skip to content

Commit

Permalink
Adapted the attribute table combobox to the "required" property of la…
Browse files Browse the repository at this point in the history
…yer combobox.

git-svn-id: http://svn.osgeo.org/qgis/trunk@11343 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rugginoso committed Aug 11, 2009
1 parent aeb951a commit 4fe683b
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/plugins/grass/qgsgrassmodule.cpp
Expand Up @@ -2439,15 +2439,19 @@ std::vector<QgsField> QgsGrassModuleInput::currentFields()
{
QgsDebugMsg( "called." );

int limit = 0;
if (!mRequired)
limit = 1;

std::vector<QgsField> fields;

int c = mLayerComboBox->currentIndex();
if ( c < 0 )
if ( c < limit )
return fields;

unsigned current = c;

if ( current >= 0 && current < mVectorFields.size() )
if ( current >= limit && current < mVectorFields.size() )
{
fields = mVectorFields[current];
}
Expand All @@ -2459,13 +2463,17 @@ QgsMapLayer * QgsGrassModuleInput::currentLayer()
{
QgsDebugMsg( "called." );

int limit = 0;
if (!mRequired)
limit = 1;

int c = mLayerComboBox->currentIndex();
if ( c < 0 )
if ( c < limit )
return 0;

unsigned int current = c;

if ( current >= 0 && current < mMapLayers.size() )
if ( current >= limit && current < mMapLayers.size() )
{
return mMapLayers[current];
}
Expand All @@ -2477,13 +2485,17 @@ QString QgsGrassModuleInput::currentMap()
{
QgsDebugMsg( "called." );

int limit = 0;
if (!mRequired)
limit = 1;

int c = mLayerComboBox->currentIndex();
if ( c < 0 )
if ( c < limit )
return QString();

unsigned int current = c;

if ( current >= 0 && current < mMaps.size() )
if ( current >= limit && current < mMaps.size() )
{
return mMaps[current];
}
Expand Down

0 comments on commit 4fe683b

Please sign in to comment.