Skip to content
Permalink
Browse files

Documentation of attribute table headers - patch from Vita Cizek.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11113 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Jul 20, 2009
1 parent c3a94ea commit 99c50f213536a9c1077f6da3d65a6ee2cd9dd2a7
@@ -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
@@ -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 );
@@ -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;
@@ -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;
};

@@ -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;

0 comments on commit 99c50f2

Please sign in to comment.
You can’t perform that action at this time.