Skip to content

Commit 4fe683b

Browse files
author
rugginoso
committed
Adapted the attribute table combobox to the "required" property of layer combobox.
git-svn-id: http://svn.osgeo.org/qgis/trunk@11343 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent aeb951a commit 4fe683b

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

src/plugins/grass/qgsgrassmodule.cpp

+18-6
Original file line numberDiff line numberDiff line change
@@ -2439,15 +2439,19 @@ std::vector<QgsField> QgsGrassModuleInput::currentFields()
24392439
{
24402440
QgsDebugMsg( "called." );
24412441

2442+
int limit = 0;
2443+
if (!mRequired)
2444+
limit = 1;
2445+
24422446
std::vector<QgsField> fields;
24432447

24442448
int c = mLayerComboBox->currentIndex();
2445-
if ( c < 0 )
2449+
if ( c < limit )
24462450
return fields;
24472451

24482452
unsigned current = c;
24492453

2450-
if ( current >= 0 && current < mVectorFields.size() )
2454+
if ( current >= limit && current < mVectorFields.size() )
24512455
{
24522456
fields = mVectorFields[current];
24532457
}
@@ -2459,13 +2463,17 @@ QgsMapLayer * QgsGrassModuleInput::currentLayer()
24592463
{
24602464
QgsDebugMsg( "called." );
24612465

2466+
int limit = 0;
2467+
if (!mRequired)
2468+
limit = 1;
2469+
24622470
int c = mLayerComboBox->currentIndex();
2463-
if ( c < 0 )
2471+
if ( c < limit )
24642472
return 0;
24652473

24662474
unsigned int current = c;
24672475

2468-
if ( current >= 0 && current < mMapLayers.size() )
2476+
if ( current >= limit && current < mMapLayers.size() )
24692477
{
24702478
return mMapLayers[current];
24712479
}
@@ -2477,13 +2485,17 @@ QString QgsGrassModuleInput::currentMap()
24772485
{
24782486
QgsDebugMsg( "called." );
24792487

2488+
int limit = 0;
2489+
if (!mRequired)
2490+
limit = 1;
2491+
24802492
int c = mLayerComboBox->currentIndex();
2481-
if ( c < 0 )
2493+
if ( c < limit )
24822494
return QString();
24832495

24842496
unsigned int current = c;
24852497

2486-
if ( current >= 0 && current < mMaps.size() )
2498+
if ( current >= limit && current < mMaps.size() )
24872499
{
24882500
return mMaps[current];
24892501
}

0 commit comments

Comments
 (0)