[QGIS Commit] r8211 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Mar 12 16:43:20 EDT 2008


Author: jef
Date: 2008-03-12 16:43:20 -0400 (Wed, 12 Mar 2008)
New Revision: 8211

Modified:
   trunk/qgis/src/app/qgsattributetable.cpp
   trunk/qgis/src/app/qgsattributetable.h
   trunk/qgis/src/app/qgsattributetabledisplay.h
Log:
allow changing attributes of added and not yet commited features

Modified: trunk/qgis/src/app/qgsattributetable.cpp
===================================================================
--- trunk/qgis/src/app/qgsattributetable.cpp	2008-03-12 14:14:09 UTC (rev 8210)
+++ trunk/qgis/src/app/qgsattributetable.cpp	2008-03-12 20:43:20 UTC (rev 8211)
@@ -32,7 +32,6 @@
 #include "qgsvectordataprovider.h"
 #include "qgsvectorlayer.h"
 
-#include <iostream>
 #include <stdlib.h>
 
 QgsAttributeTable::QgsAttributeTable(QWidget * parent, const char *name):
@@ -586,14 +585,22 @@
     int id=text(row,0).toInt();
     QString field = horizontalHeader()->label(column);
 
-    // add empty map for feature if doesn't exist
-    if (!mChangedValues.contains(id))
+    if(id>=0)
     {
-      mChangedValues.insert(id, QMap<QString, QString>());
+      // add empty map for feature if doesn't exist
+      if (!mChangedValues.contains(id))
+      {
+        mChangedValues.insert(id, QMap<QString, QString>());
+      }
+
+      mChangedValues[id].insert(field, text(row,column));
+      mEdited=true;
     }
-
-    mChangedValues[id].insert(field, text(row,column));
-    mEdited=true;
+    else
+    {
+      // added feature attribute changed
+      emit featureAttributeChanged(row,column);
+    }
   }
 }
 

Modified: trunk/qgis/src/app/qgsattributetable.h
===================================================================
--- trunk/qgis/src/app/qgsattributetable.h	2008-03-12 14:14:09 UTC (rev 8210)
+++ trunk/qgis/src/app/qgsattributetable.h	2008-03-12 20:43:20 UTC (rev 8211)
@@ -104,15 +104,16 @@
     /** Shows all rows */
     void showAllRows();
 
-    public slots:
-      void columnClicked(int col);
-      void rowClicked(int row);
+  public slots:
+    void columnClicked(int col);
+    void rowClicked(int row);
     // Called when the user requests a popup menu
     void popupMenu(int row, int col, const QPoint& pos);
     // Called when the user chooses an item on the popup menu
     void popupItemSelected(QAction * menuAction);
-    protected slots:
-      void handleChangedSelections();
+
+  protected slots:
+    void handleChangedSelections();
     /**Writes changed values to 'mChangedValues'*/
     void storeChangedValue(int row, int column);
 
@@ -156,14 +157,15 @@
      Also, mLastSelectedRows is updated*/
     bool checkSelectionChanges();
 
-signals:
-
+  signals:
     /**Is emitted when a row was selected*/
     void selected(int, bool);
     /**Is emitted when all rows have been deselected*/
     void selectionRemoved(bool);
-    /**Is emmited when a set of related selection and deselection signals have been emitted*/
+    /**Is emitted when a set of related selection and deselection signals have been emitted*/
     void repaintRequested();
+    /**Is emitted when a attribute of a added feature is changed*/
+    void featureAttributeChanged(int row, int column);
 
   private:
     // Data to do with providing a popup menu of actions that

Modified: trunk/qgis/src/app/qgsattributetabledisplay.h
===================================================================
--- trunk/qgis/src/app/qgsattributetabledisplay.h	2008-03-12 14:14:09 UTC (rev 8210)
+++ trunk/qgis/src/app/qgsattributetabledisplay.h	2008-03-12 20:43:20 UTC (rev 8211)
@@ -73,8 +73,12 @@
     void searchShowResultsChanged(int item);
     void on_btnHelp_clicked();
 
+  public slots:
+    void changeFeatureAttribute(int row, int column);
+
   signals:
     void deleted();
+
   private:
     /** Set the icon theme for this dialog */
     void setTheme();



More information about the QGIS-commit mailing list