Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Documentation of attribute table headers - patch from Vita Cizek.
git-svn-id: http://svn.osgeo.org/qgis/trunk@11113 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jul 20, 2009
1 parent f1167f0 commit 08962ea
Show file tree
Hide file tree
Showing 7 changed files with 291 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/app/attributetable/qgsattributetabledelegate.h
Expand Up @@ -27,7 +27,9 @@ class QgsAttributeTableDelegate : public QItemDelegate
{
Q_OBJECT;
public:
/** Constructor */
/** Constructor
* @param parent parent object
*/
QgsAttributeTableDelegate( QObject* parent = NULL ) :
QItemDelegate( parent ) {};
/** Used to create an editor for when the user tries to
Expand Down
84 changes: 83 additions & 1 deletion src/app/attributetable/qgsattributetabledialog.h
Expand Up @@ -45,42 +45,124 @@ class QgsAttributeTableDialog : public QDialog, private Ui::QgsAttributeTableDia
Q_OBJECT

public:
/**
* Constructor
* @param theLayer layer pointer
* @param parent parent object
* @param flags window flags
*/
QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWidget *parent = 0, Qt::WindowFlags flags = Qt::Window );
~QgsAttributeTableDialog();

public slots:
/**
* Toggles editing mode
*/
void editingToggled();

private slots:
/**
* submits the data
*/
void submit();
/**
* Reverts the changes
*/
void revert();
/**
* Launches search
*/
void search();
/**
* Launches advanced search
*/
void on_mAdvancedSearchButton_clicked();
/**
* Updates the selection
*/
void updateSelection();
/**
* Reads the selection from the layer
*/
void updateSelectionFromLayer();
/**
* Updates selection of a row
*/
void updateRowSelection( int index );
/**
* Updates selection of specifed rows
* @param first first row
* @param last last row
* @param startNewSelection if true, then new selection is started
*/
void updateRowSelection( int first, int last, bool startNewSelection );

/**
* Toggle showing of selected line only
* @param theFlag toggle on if true
*/
void on_cbxShowSelectedOnly_toggled( bool theFlag );
/**
* Copies selected rows to the clipboard
*/
void on_mCopySelectedRowsButton_clicked();

/**
* Toggles editing mode
*/
void on_mToggleEditingButton_toggled();
/**
* Inverts selection
*/
void on_mInvertSelectionButton_clicked();
/**
* Clears selection
*/
void on_mRemoveSelectionButton_clicked();
/**
* Zooms to selected features
*/
void on_mZoomMapToSelectedRowsButton_clicked();
/**
* Moves selected lines to the top
*/
void on_mSelectedToTopButton_clicked();
/**
* Shows advanced actions
*/
void showAdvanced();
/**
* Starts editing mode
*/
void startEditing();

signals:
void editingToggled( QgsMapLayer * );
/**
* Informs that editing mode ha been toggled
* @param layer layer that has been toggled
*/
void editingToggled( QgsMapLayer *layer );

protected:
/**
* Handle closing of the window
* @param event unused
*/
void closeEvent( QCloseEvent* event );

private:
/**
* Initialize column box
*/
void columnBoxInit();
/**
* Returns id of a column
*/
int columnBoxColumnId();
/**
* Performs the search
* @param searchString search query string
*/
void doSearch( QString searchString );

QIcon getThemeIcon( const QString theName );
Expand Down
18 changes: 16 additions & 2 deletions src/app/attributetable/qgsattributetablefiltermodel.h
Expand Up @@ -26,12 +26,26 @@
class QgsAttributeTableFilterModel: public QSortFilterProxyModel
{
public:
bool mHideUnselected;
/**
* Constructor
* @param theLayer initializing layer pointer
*/
QgsAttributeTableFilterModel( QgsVectorLayer* theLayer );
/**
* Sorts model by the column
* @param column column to sort by
* @param order sorting order
*/
virtual void sort( int column, Qt::SortOrder order = Qt::AscendingOrder );
//QModelIndex mapToSource ( const QModelIndex & filterIndex ) const;
//QModelIndex mapFromSource ( const QModelIndex & sourceIndex ) const;
bool mHideUnselected;
virtual void sort( int column, Qt::SortOrder order = Qt::AscendingOrder );
protected:
/**
* Returns true if the source row will be accepted
* @param sourceRow row from the source model
* @param sourceParent parent index in the source model
*/
bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const;
private:
QgsVectorLayer* mLayer;
Expand Down
4 changes: 4 additions & 0 deletions src/app/attributetable/qgsattributetableidcolumnpair.h
Expand Up @@ -25,6 +25,10 @@ class QgsAttributeTableIdColumnPair
int id;
QVariant columnItem;

/**
* Returns true if this id-column pair is less the the tested one
* @param b the tested id-column pair
*/
bool operator<( const QgsAttributeTableIdColumnPair &b ) const;
};

Expand Down
52 changes: 50 additions & 2 deletions src/app/attributetable/qgsattributetablememorymodel.h
Expand Up @@ -32,22 +32,70 @@ class QgsAttributeTableMemoryModel: public QgsAttributeTableModel
Q_OBJECT;

public:
QgsAttributeTableMemoryModel( QgsVectorLayer *theLayer );//, QObject *parent = 0);
/**
* Constructor
* @param theLayer layer pointer
*/
QgsAttributeTableMemoryModel( QgsVectorLayer *theLayer );

protected slots:
/**
* Launched when a feature has been deleted
* @param fid feature id
*/
virtual void featureDeleted( int fid );
/**
* Launched when a feature has been deleted
* @param fid feature id
*/
virtual void featureAdded( int fid );
/**
* Launched when layer has been deleted
*/
virtual void layerDeleted();

private slots:
/**
* Launched when attribute has been added
* @param idx attribute index
*/
//virtual void attributeAdded (int idx);
/**
* Launched when attribute has been deleted
* @param idx attribute index
*/
//virtual void attributeDeleted (int idx);
virtual void attributeValueChanged( int fid, int idx, const QVariant &value );
/**
* Launched when layer has been modified
* Rebuilds the model
* @param onlyGeometry true if only geometry has changed
*/
//virtual void layerModified(bool onlyGeometry);
/**
* Launched when attribute value has been changed
* @param fid feature id
* @param idx attribute index
* @param value new value
*/
virtual void attributeValueChanged( int fid, int idx, const QVariant &value );

private:
/**
* Returns data on the given index
* @param index model index
* @param role data role
*/
virtual QVariant data( const QModelIndex &index, int role ) const;
/**
* Updates data on given index
* @param index model index
* @param value new data value
* @param role data role
*/
virtual bool setData( const QModelIndex &index, const QVariant &value, int role );
/**
* Loads the layer into the model
*/
virtual void loadLayer();

QMap<int, QgsFeature> mFeatureMap;
Expand Down

0 comments on commit 08962ea

Please sign in to comment.