Skip to content

Commit ba35e60

Browse files
author
wonder
committed
Fix for #231 - allow parameters with fixed number of line edits, e.g. grid=20,30
git-svn-id: http://svn.osgeo.org/qgis/trunk@6195 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent f3d99b1 commit ba35e60

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

src/plugins/grass/qgsgrassmodule.cpp

+29-5
Original file line numberDiff line numberDiff line change
@@ -1728,12 +1728,34 @@ QgsGrassModuleOption::QgsGrassModuleOption ( QgsGrassModule *module, QString key
17281728
}
17291729
}
17301730
}
1731-
1732-
addLineEdit();
1733-
1734-
// add/delete buttons for multiple options
1735-
if ( gelem.attribute("multiple") == "yes" )
1731+
1732+
QDomNode keydescNode = gnode.namedItem ( "keydesc" );
1733+
if (!keydescNode.isNull())
1734+
{
1735+
// fixed number of line edits
1736+
// Example:
1737+
// <keydesc>
1738+
// <item order="1">rows</item>
1739+
// <item order="2">columns</item>
1740+
// </keydesc>
1741+
1742+
QDomNodeList keydescs = keydescNode.childNodes();
1743+
for (int k = 0; k < keydescs.count(); k++)
1744+
{
1745+
QDomNode nodeItem = keydescs.at(k);
1746+
QString itemDesc = nodeItem.toElement().text().stripWhiteSpace();
1747+
//QString itemDesc = nodeItem.firstChild().toText().data();
1748+
std::cerr << "keydesc item = " << itemDesc.toLocal8Bit().data() << std::endl;
1749+
1750+
addLineEdit();
1751+
}
1752+
1753+
setLayout(mLayout);
1754+
}
1755+
else if ( gelem.attribute("multiple") == "yes" )
17361756
{
1757+
// variable number of line edits
1758+
// add/delete buttons for multiple options
17371759
QHBoxLayout *l = new QHBoxLayout (this);
17381760
QVBoxLayout *vl = new QVBoxLayout ();
17391761
l->insertLayout( -1, mLayout );
@@ -1753,6 +1775,8 @@ QgsGrassModuleOption::QgsGrassModuleOption ( QgsGrassModule *module, QString key
17531775
}
17541776
else
17551777
{
1778+
// only one line edit
1779+
addLineEdit();
17561780
setLayout ( mLayout );
17571781
}
17581782
}

0 commit comments

Comments
 (0)