[QGIS Commit] r9396 - trunk/external_plugins/cdp2/src/gui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Sep 23 18:48:41 EDT 2008


Author: timlinux
Date: 2008-09-23 18:48:41 -0400 (Tue, 23 Sep 2008)
New Revision: 9396

Modified:
   trunk/external_plugins/cdp2/src/gui/climatedataprocessorgui.cpp
Log:
Added some logic to process checked items

Modified: trunk/external_plugins/cdp2/src/gui/climatedataprocessorgui.cpp
===================================================================
--- trunk/external_plugins/cdp2/src/gui/climatedataprocessorgui.cpp	2008-09-23 22:18:52 UTC (rev 9395)
+++ trunk/external_plugins/cdp2/src/gui/climatedataprocessorgui.cpp	2008-09-23 22:48:41 UTC (rev 9396)
@@ -63,30 +63,20 @@
 
   myController.setOutputPath(leOutputPath->text());
 
-  //specif which of the available calcs we want to actually do
+  //specify which of the available calcs we want to actually do
   if (! myController.makeAvailableCalculationsMap() )
   {
     qDebug ("Error making available calcs map");
   }
   else //available calcs map made ok
   {
-    QMap<QString, bool> myMap = myController.availableCalculationsMap();
-    QMapIterator<QString, bool> myMapIterator(myMap);
-    while (myMapIterator.hasNext())
+    for ( int myCounter = 0; myCounter < lstVariablesToCalc->count(); myCounter++ )
     {
-      myMapIterator.next();
-      QString myKey = myMapIterator.key();
-      bool myValue = myMapIterator.value();
-      QListWidgetItem * mypItem = new QListWidgetItem(myKey,lstVariablesToCalc);
-      mypItem->setFlags(mypItem->flags() | Qt::ItemIsUserCheckable);
-      if (myValue)
+      QListWidgetItem * mypItem = lstVariablesToCalc->item(myCounter);
+      if (mypItem->checkState()==Qt::Checked)
       {
-        mypItem->setCheckState(Qt::Checked);
+        myController.addUserCalculation(mypItem->text());
       }
-      else
-      {
-        mypItem->setCheckState(Qt::Unchecked);
-      }
     }
     // Show a summary of the controller state (for debug purposes only)  
     qDebug(myController.description().toLocal8Bit());
@@ -196,6 +186,7 @@
   {
     QMap<QString, bool> myMap = myController.availableCalculationsMap();
     QMapIterator<QString, bool> myMapIterator(myMap);
+    lstVariablesToCalc->clear();
     while (myMapIterator.hasNext())
     {
       myMapIterator.next();



More information about the QGIS-commit mailing list