[QGIS Commit] r11113 - trunk/qgis/src/app/attributetable

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Jul 20 08:12:56 EDT 2009


Author: wonder
Date: 2009-07-20 08:12:55 -0400 (Mon, 20 Jul 2009)
New Revision: 11113

Modified:
   trunk/qgis/src/app/attributetable/qgsattributetabledelegate.h
   trunk/qgis/src/app/attributetable/qgsattributetabledialog.h
   trunk/qgis/src/app/attributetable/qgsattributetablefiltermodel.h
   trunk/qgis/src/app/attributetable/qgsattributetableidcolumnpair.h
   trunk/qgis/src/app/attributetable/qgsattributetablememorymodel.h
   trunk/qgis/src/app/attributetable/qgsattributetablemodel.h
   trunk/qgis/src/app/attributetable/qgsattributetableview.h
Log:
Documentation of attribute table headers - patch from Vita Cizek.


Modified: trunk/qgis/src/app/attributetable/qgsattributetabledelegate.h
===================================================================
--- trunk/qgis/src/app/attributetable/qgsattributetabledelegate.h	2009-07-20 12:05:25 UTC (rev 11112)
+++ trunk/qgis/src/app/attributetable/qgsattributetabledelegate.h	2009-07-20 12:12:55 UTC (rev 11113)
@@ -27,7 +27,9 @@
 {
     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

Modified: trunk/qgis/src/app/attributetable/qgsattributetabledialog.h
===================================================================
--- trunk/qgis/src/app/attributetable/qgsattributetabledialog.h	2009-07-20 12:05:25 UTC (rev 11112)
+++ trunk/qgis/src/app/attributetable/qgsattributetabledialog.h	2009-07-20 12:12:55 UTC (rev 11113)
@@ -45,42 +45,124 @@
     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 );

Modified: trunk/qgis/src/app/attributetable/qgsattributetablefiltermodel.h
===================================================================
--- trunk/qgis/src/app/attributetable/qgsattributetablefiltermodel.h	2009-07-20 12:05:25 UTC (rev 11112)
+++ trunk/qgis/src/app/attributetable/qgsattributetablefiltermodel.h	2009-07-20 12:12:55 UTC (rev 11113)
@@ -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;

Modified: trunk/qgis/src/app/attributetable/qgsattributetableidcolumnpair.h
===================================================================
--- trunk/qgis/src/app/attributetable/qgsattributetableidcolumnpair.h	2009-07-20 12:05:25 UTC (rev 11112)
+++ trunk/qgis/src/app/attributetable/qgsattributetableidcolumnpair.h	2009-07-20 12:12:55 UTC (rev 11113)
@@ -25,6 +25,10 @@
     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;
 };
 

Modified: trunk/qgis/src/app/attributetable/qgsattributetablememorymodel.h
===================================================================
--- trunk/qgis/src/app/attributetable/qgsattributetablememorymodel.h	2009-07-20 12:05:25 UTC (rev 11112)
+++ trunk/qgis/src/app/attributetable/qgsattributetablememorymodel.h	2009-07-20 12:12:55 UTC (rev 11113)
@@ -32,22 +32,70 @@
     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);
+    /**
+     * 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 );
-    //virtual void layerModified(bool onlyGeometry);
 
   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;

Modified: trunk/qgis/src/app/attributetable/qgsattributetablemodel.h
===================================================================
--- trunk/qgis/src/app/attributetable/qgsattributetablemodel.h	2009-07-20 12:05:25 UTC (rev 11112)
+++ trunk/qgis/src/app/attributetable/qgsattributetablemodel.h	2009-07-20 12:12:55 UTC (rev 11113)
@@ -31,40 +31,147 @@
     Q_OBJECT
 
   public:
+    /**
+     * Constructor
+     * @param theLayer layer pointer
+     * @param parent parent pointer
+     */
     QgsAttributeTableModel( QgsVectorLayer *theLayer, QObject *parent = 0 );
 
+    /**
+     * Returns the number of rows
+     * @param parent parent index
+     */
     int rowCount( const QModelIndex &parent = QModelIndex() ) const;
+    /**
+     * Returns the number of columns
+     * @param parent parent index
+     */
     int columnCount( const QModelIndex &parent = QModelIndex() ) const;
 
+    /**
+     * Returns header data
+     * @param section required section
+     * @param orientation horizontal or vertical orientation
+     * @param role data role
+     */
     QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
+    /**
+     * 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 = Qt::EditRole );
+    /**
+     * Returns item flags for the index
+     * @param index model index
+     */
     Qt::ItemFlags flags( const QModelIndex &index ) const;
 
+    /**
+     * Reloads the model data between indices
+     * @param index1 start index
+     * @param index2 end index
+     */
     void reload( const QModelIndex &index1, const QModelIndex &index2 );
+    /**
+     * Resets the model
+     */
     void resetModel();
+    /**
+     * Layout has been changed
+     */
     void changeLayout();
+    /**
+     * Layout will be changed
+     */
     void incomingChangeLayout();
+    /**
+     * Maps feature id to table row
+     * @param id feature id
+     */
     int idToRow( const int id ) const;
+    /**
+     * Maps row to feature id
+     * @param id row id
+     */
     int rowToId( const int id ) const;
+    /**
+     * Sorts the model
+     * @param column column to sort by
+     * @param order sorting order
+     */
     virtual void sort( int column, Qt::SortOrder order = Qt::AscendingOrder );
+    /**
+     * Swaps two rows
+     * @param a first row
+     * @param b second row
+     */
     void swapRows( int a, int b );
 
+    /**
+     * Returns layer pointer
+     */
     QgsVectorLayer* layer() const { return mLayer; }
 
   signals:
+    /**
+     * Model has been changed
+     */
     void modelChanged();
+    /**
+     * Sets new number of rows
+     * @param oldNum old row number
+     * @param newNum new row number
+     */
     void setNumRows( int oldNum, int newNum );
 
   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 );
+    /**
+     * 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 );
+    /**
+     * Launched when layer has been modified
+     * Rebuilds the model
+     * @param onlyGeometry true if only geometry has changed
+     */
     virtual void layerModified( bool onlyGeometry );
 
   protected slots:
+    /**
+     * Launched when a feature has been deleted
+     * @param fid feature id
+     */
     virtual void featureDeleted( int fid );
+    /**
+     * Launched when a feature has been added
+     * @param fid feature id
+     */
     virtual void featureAdded( int fid );
+    /**
+     * Launched when layer has been deleted
+     */
     virtual void layerDeleted();
 
   protected:
@@ -81,7 +188,13 @@
     QMap<int, int> mIdRowMap;
     QMap<int, int> mRowIdMap;
 
+    /**
+     * Initializes id <-> row maps
+     */
     void initIdMaps();
+    /**
+     * Loads the layer into the model
+     */
     virtual void loadLayer();
 
 };

Modified: trunk/qgis/src/app/attributetable/qgsattributetableview.h
===================================================================
--- trunk/qgis/src/app/attributetable/qgsattributetableview.h	2009-07-20 12:05:25 UTC (rev 11112)
+++ trunk/qgis/src/app/attributetable/qgsattributetableview.h	2009-07-20 12:12:55 UTC (rev 11113)
@@ -30,12 +30,34 @@
     QgsAttributeTableView( QWidget* parent = NULL );
     virtual ~QgsAttributeTableView();
 
+    /**
+     * Sets the layer
+     * @param layer layer pointer
+     */
     void setLayer( QgsVectorLayer* layer );
 
+    /**
+     * Saves geometry to the settings on close
+     * @param event not used
+     */
     void closeEvent( QCloseEvent *event );
+    /**
+     * Handles Ctrl or Shift key press
+     * @param event the key pressed
+     */
     void keyPressEvent( QKeyEvent *event );
+    /**
+     * Handles Ctrl or Shift key release
+     * @param event the key released
+     */
     void keyReleaseEvent( QKeyEvent *event );
+    /**
+     * Returns true if shift was pressed
+     */
     bool shiftPressed() { return mShiftPressed; }
+    /**
+     * Returns true if ctrl was pressed
+     */
     bool ctrlPressed() { return mCtrlPressed; }
 
   private:



More information about the QGIS-commit mailing list