Skip to content

Commit

Permalink
allow changing attributes of added and not yet commited features
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8211 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Mar 12, 2008
1 parent 168d651 commit 863d256
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
21 changes: 14 additions & 7 deletions src/app/qgsattributetable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "qgsvectordataprovider.h"
#include "qgsvectorlayer.h"

#include <iostream>
#include <stdlib.h>

QgsAttributeTable::QgsAttributeTable(QWidget * parent, const char *name):
Expand Down Expand Up @@ -586,14 +585,22 @@ void QgsAttributeTable::storeChangedValue(int row, int column)
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);
}
}
}

Expand Down
18 changes: 10 additions & 8 deletions src/app/qgsattributetable.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,16 @@ class QgsAttributeTable:public Q3Table
/** 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);

Expand Down Expand Up @@ -156,14 +157,15 @@ class QgsAttributeTable:public Q3Table
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
Expand Down
4 changes: 4 additions & 0 deletions src/app/qgsattributetabledisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ class QgsAttributeTableDisplay:public QDialog, private Ui::QgsAttributeTableBase
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();
Expand Down

0 comments on commit 863d256

Please sign in to comment.