Skip to content
Permalink
Browse files

Added the possibility to unselect an optional (required="no" into int…

…erface-description of the grass module) to fix #1134.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11328 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rugginoso
rugginoso committed Aug 10, 2009
1 parent 6a10de8 commit ee75633d0f60045685e88308d260065e58c32732
Showing with 20 additions and 1 deletion.
  1. +17 −1 src/plugins/grass/qgsgrassmodule.cpp
  2. +3 −0 src/plugins/grass/qgsgrassmodule.h
@@ -1992,7 +1992,7 @@ QgsGrassModuleInput::QgsGrassModuleInput( QgsGrassModule *module,
: QgsGrassModuleGroupBoxItem( module, key, qdesc, gdesc, gnode, parent ),
mModuleStandardOptions( options ),
mGeometryTypeOption( 0 ), mVectorLayerOption( 0 ),
mRegionButton( 0 ), mUpdate( false )
mRegionButton( 0 ), mUpdate( false ), mRequired( false )
{
QgsDebugMsg( "called." );
mGeometryTypeMask = GV_POINT | GV_LINE | GV_AREA;
@@ -2003,6 +2003,13 @@ QgsGrassModuleInput::QgsGrassModuleInput( QgsGrassModule *module,
}
adjustTitle();

// Check if this parameter is required
if (gnode.toElement().attribute("required") == "yes") {
mRequired = true;
} else {
mRequired = false;
}

QDomNode promptNode = gnode.namedItem( "gisprompt" );
QDomElement promptElem = promptNode.toElement();
QString element = promptElem.attribute( "element" );
@@ -2212,6 +2219,15 @@ void QgsGrassModuleInput::updateQgisLayers()
mMapLayers.resize( 0 );
mVectorFields.resize( 0 );

// If not required, add an empty item to combobox and a padding item into
// layer containers.
if (!mRequired){
mMaps.push_back(QString(""));
mVectorLayerNames.push_back(QString(""));
mMapLayers.push_back(NULL);
mLayerComboBox->addItem(tr("Select a layer"), QVariant());
}

QgsMapCanvas *canvas = mModule->qgisIface()->mapCanvas();

// Find map option
@@ -638,6 +638,9 @@ class QgsGrassModuleInput: public QgsGrassModuleGroupBoxItem

//! Uses region
bool mUsesRegion;

//! Required field
bool mRequired;
};

/*********************** QgsGrassModuleGdalInput **********************/

0 comments on commit ee75633

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