mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-04 00:06:15 -04:00
fixed #1619, and another not yet reported bug for field
git-svn-id: http://svn.osgeo.org/qgis/trunk@12679 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
74312693ec
commit
9dd0eff791
src/plugins/grass
@ -5,5 +5,5 @@
|
|||||||
<option key="vector" layeroption="layer" typemask="point"/>
|
<option key="vector" layeroption="layer" typemask="point"/>
|
||||||
<field key="column" layer="vector" type="integer,double,string"/>
|
<field key="column" layer="vector" type="integer,double,string"/>
|
||||||
<option key="qvector" layeroption="layer" typemask="area"/>
|
<option key="qvector" layeroption="layer" typemask="area"/>
|
||||||
<option key="qcolumn" layer="qvector" type="string"/>
|
<field key="qcolumn" layer="qvector" type="string"/>
|
||||||
</qgisgrassmodule>
|
</qgisgrassmodule>
|
||||||
|
@ -562,6 +562,23 @@ QStringList QgsGrassModuleStandardOptions::arguments()
|
|||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// id is not used in fact, was intended for field, but key is used instead
|
||||||
|
QgsGrassModuleItem *QgsGrassModuleStandardOptions::itemByKey( QString key )
|
||||||
|
{
|
||||||
|
QgsDebugMsg( "key = " + key );
|
||||||
|
|
||||||
|
for ( unsigned int i = 0; i < mItems.size(); i++ )
|
||||||
|
{
|
||||||
|
if ( mItems[i]->key() == key )
|
||||||
|
{
|
||||||
|
return mItems[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QMessageBox::warning( 0, tr( "Warning" ), tr( "Item with key %1 not found" ).arg( key ) );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
QgsGrassModuleItem *QgsGrassModuleStandardOptions::item( QString id )
|
QgsGrassModuleItem *QgsGrassModuleStandardOptions::item( QString id )
|
||||||
{
|
{
|
||||||
QgsDebugMsg( "id = " + id );
|
QgsDebugMsg( "id = " + id );
|
||||||
@ -2908,16 +2925,19 @@ QgsGrassModuleField::QgsGrassModuleField(
|
|||||||
QDomElement promptElem = promptNode.toElement();
|
QDomElement promptElem = promptNode.toElement();
|
||||||
QString element = promptElem.attribute( "element" );
|
QString element = promptElem.attribute( "element" );
|
||||||
|
|
||||||
mLayerId = qdesc.attribute( "layerid" );
|
|
||||||
|
|
||||||
mType = qdesc.attribute( "type" );
|
mType = qdesc.attribute( "type" );
|
||||||
|
|
||||||
QgsGrassModuleItem *item = mModuleStandardOptions->item( mLayerId );
|
mLayerKey = qdesc.attribute( "layer" );
|
||||||
// TODO check type
|
if ( mLayerKey.isNull() || mLayerKey.length() == 0 ) {
|
||||||
if ( item )
|
QMessageBox::warning( 0, tr( "Warning" ), tr( "'layer' attribute in field tag with key= %1 is missing." ).arg( mKey ) );
|
||||||
{
|
} else {
|
||||||
mLayerInput = dynamic_cast<QgsGrassModuleInput *>( item );
|
QgsGrassModuleItem *item = mModuleStandardOptions->itemByKey( mLayerKey );
|
||||||
connect( mLayerInput, SIGNAL( valueChanged() ), this, SLOT( updateFields() ) );
|
// TODO check type
|
||||||
|
if ( item )
|
||||||
|
{
|
||||||
|
mLayerInput = dynamic_cast<QgsGrassModuleInput *>( item );
|
||||||
|
connect( mLayerInput, SIGNAL( valueChanged() ), this, SLOT( updateFields() ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QHBoxLayout *l = new QHBoxLayout( this );
|
QHBoxLayout *l = new QHBoxLayout( this );
|
||||||
|
@ -256,6 +256,9 @@ class QgsGrassModuleStandardOptions: QWidget, public QgsGrassModuleOptions
|
|||||||
// ! Get item by ID
|
// ! Get item by ID
|
||||||
QgsGrassModuleItem *item( QString id );
|
QgsGrassModuleItem *item( QString id );
|
||||||
|
|
||||||
|
// ! Get item by key
|
||||||
|
QgsGrassModuleItem *itemByKey( QString key );
|
||||||
|
|
||||||
// Reimplemented methods from QgsGrassModuleOptions
|
// Reimplemented methods from QgsGrassModuleOptions
|
||||||
QStringList checkOutput();
|
QStringList checkOutput();
|
||||||
void freezeOutput();
|
void freezeOutput();
|
||||||
@ -749,7 +752,7 @@ class QgsGrassModuleField: public QgsGrassModuleGroupBoxItem
|
|||||||
QgsGrassModuleStandardOptions *mModuleStandardOptions;
|
QgsGrassModuleStandardOptions *mModuleStandardOptions;
|
||||||
|
|
||||||
//! Layer key
|
//! Layer key
|
||||||
QString mLayerId;
|
QString mLayerKey;
|
||||||
|
|
||||||
//! Pointer to layer input
|
//! Pointer to layer input
|
||||||
QgsGrassModuleInput *mLayerInput;
|
QgsGrassModuleInput *mLayerInput;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user