Skip to content

Commit

Permalink
Doxygen and sip bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed May 2, 2016
1 parent dd88fa9 commit c369aab
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 34 deletions.
2 changes: 1 addition & 1 deletion python/core/qgsactionmanager.sip
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
qgsattributemanager.h qgsactionmanager.sip


These classes store and control the managment and execution of actions These classes store and control the managment and execution of actions
associated with a particular Qgis layer. Actions are defined to be associated with a particular Qgis layer. Actions are defined to be
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsattributeaction.sip
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
qgsactionmanager.h qgsattributeaction.sip


This is a legacy header to keep backwards compatibility until QGIS 3. This is a legacy header to keep backwards compatibility until QGIS 3.


Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsattributetableconfig.sip
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
qgsattributetableconfig.h - QgsAttributeTableConfig qgsattributetableconfig.sip


--------------------- ---------------------
begin : 27.4.2016 begin : 27.4.2016
Expand Down
46 changes: 35 additions & 11 deletions python/gui/attributetable/qgsattributetablefiltermodel.sip
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ class QgsAttributeTableFilterModel: QSortFilterProxyModel, QgsFeatureModel
#include <qgsattributetablefiltermodel.h> #include <qgsattributetablefiltermodel.h>
%End %End
public: public:
/**
* The filter mode defines how the rows should be filtered.
*/
enum FilterMode enum FilterMode
{ {
ShowAll, ShowAll,
Expand All @@ -13,20 +16,27 @@ class QgsAttributeTableFilterModel: QSortFilterProxyModel, QgsFeatureModel
ShowEdited ShowEdited
}; };


/**
* The type of a column.
*/
enum ColumnType enum ColumnType
{ {
ColumnTypeField, //!< This column shows a field ColumnTypeField, //!< This column shows a field
ColumnTypeActionButton //!< This column shows action buttons ColumnTypeActionButton //!< This column shows action buttons
}; };


/**
* The additional roles defined by this filter model.
* The values of these roles start just after the roles defined by
* QgsAttributeTableModel so they do not conflict.
*/
enum Role enum Role
{ {
TypeRole = QgsAttributeTableModel::UserRole //!< The type of a given column TypeRole = QgsAttributeTableModel::UserRole //!< The type of a given column
}; };




/** /**
*
* Make sure, the master model is already loaded, so the selection will get synchronized. * Make sure, the master model is already loaded, so the selection will get synchronized.
* *
* @param parent parent object (owner) * @param parent parent object (owner)
Expand All @@ -35,6 +45,13 @@ class QgsAttributeTableFilterModel: QSortFilterProxyModel, QgsFeatureModel
*/ */
QgsAttributeTableFilterModel( QgsMapCanvas* canvas, QgsAttributeTableModel* sourceModel, QObject* parent /TransferThis/ = 0 ); QgsAttributeTableFilterModel( QgsMapCanvas* canvas, QgsAttributeTableModel* sourceModel, QObject* parent /TransferThis/ = 0 );


/**
* Set the attribute table model that backs this model
*
* @param sourceModel The model
*
* @note added in 2.0
*/
void setSourceModel( QgsAttributeTableModel* sourceModel ); void setSourceModel( QgsAttributeTableModel* sourceModel );


/** /**
Expand All @@ -60,6 +77,11 @@ class QgsAttributeTableFilterModel: QSortFilterProxyModel, QgsFeatureModel
*/ */
virtual void setFilteredFeatures( const QgsFeatureIds& ids ); virtual void setFilteredFeatures( const QgsFeatureIds& ids );


/**
* Get a list of currently filtered feature ids
*
* @return A list of feature ids
*/
QgsFeatureIds filteredFeatures(); QgsFeatureIds filteredFeatures();


/** /**
Expand All @@ -69,6 +91,9 @@ class QgsAttributeTableFilterModel: QSortFilterProxyModel, QgsFeatureModel
*/ */
void setFilterMode( FilterMode filterMode ); void setFilterMode( FilterMode filterMode );


/**
* The current filterModel
*/
FilterMode filterMode(); FilterMode filterMode();


/** /**
Expand Down Expand Up @@ -108,6 +133,15 @@ class QgsAttributeTableFilterModel: QSortFilterProxyModel, QgsFeatureModel


virtual QModelIndex mapFromMaster( const QModelIndex &sourceIndex ) const; virtual QModelIndex mapFromMaster( const QModelIndex &sourceIndex ) const;


/**
* Sort by the given column using the given order.
* Prefetches all the data from the layer to speed up sorting.
*
* @param column The column which should be sorted
* @param order The order ( Qt::AscendingOrder or Qt::DescendingOrder )
*/
virtual void sort( int column, Qt::SortOrder order = Qt::AscendingOrder );

/** Returns the map canvas*/ /** Returns the map canvas*/
QgsMapCanvas* mapCanvas() const; QgsMapCanvas* mapCanvas() const;


Expand Down Expand Up @@ -151,20 +185,10 @@ class QgsAttributeTableFilterModel: QSortFilterProxyModel, QgsFeatureModel
*/ */
bool lessThan( const QModelIndex &left, const QModelIndex &right ) const; bool lessThan( const QModelIndex &left, const QModelIndex &right ) const;


/**
* Sort by the given column using the given order.
* Prefetches all the data from the layer to speed up sorting.
*
* @param column The column which should be sorted
* @param order The order ( Qt::AscendingOrder or Qt::DescendingOrder )
*/
virtual void sort( int column, Qt::SortOrder order = Qt::AscendingOrder );

public slots: public slots:
/** /**
* Is called upon every change of the visible extents on the map canvas. * Is called upon every change of the visible extents on the map canvas.
* When a change is signalled, the filter is updated and invalidated if needed. * When a change is signalled, the filter is updated and invalidated if needed.
*
*/ */
void extentsChanged(); void extentsChanged();


Expand Down
27 changes: 21 additions & 6 deletions src/core/qgsaction.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -35,26 +35,45 @@ class CORE_EXPORT QgsAction
OpenUrl, OpenUrl,
}; };


/**
* Create a new QgsAction
*
* @param type The type of this action
* @param description A human readable description string
* @param action The action text. Its interpretation depends on the type
* @param capture If this is set to true, the output will be captured when an action is run
*/
QgsAction( ActionType type, const QString& description, const QString& action, bool capture ) QgsAction( ActionType type, const QString& description, const QString& action, bool capture )
: mType( type ) : mType( type )
, mDescription( description ) , mDescription( description )
, mAction( action ) , mAction( action )
, mCaptureOutput( capture ) , mCaptureOutput( capture )
{} {}


QgsAction( ActionType type, const QString& description, const QString& action, const QString& icon, bool capture, const QString& shortTitle = QString(), bool showInAttributeTable = true )
/**
* Create a new QgsAction
*
* @param type The type of this action
* @param description A human readable description string
* @param action The action text. Its interpretation depends on the type
* @param icon Path to an icon for this action
* @param capture If this is set to true, the output will be captured when an action is run
* @param shortTitle A short string used to label user interface elements like buttons
*/
QgsAction( ActionType type, const QString& description, const QString& action, const QString& icon, bool capture, const QString& shortTitle = QString() )
: mType( type ) : mType( type )
, mDescription( description ) , mDescription( description )
, mShortTitle( shortTitle ) , mShortTitle( shortTitle )
, mIcon( icon ) , mIcon( icon )
, mAction( action ) , mAction( action )
, mCaptureOutput( capture ) , mCaptureOutput( capture )
, mShowInAttributeTable( showInAttributeTable )
{} {}


//! The name of the action. This may be a longer description. //! The name of the action. This may be a longer description.
QString name() const { return mDescription; } QString name() const { return mDescription; }


//! The short title is used to label user interface elements like buttons
QString shortTitle() const { return mShortTitle; } QString shortTitle() const { return mShortTitle; }


//! The path to the icon //! The path to the icon
Expand All @@ -72,9 +91,6 @@ class CORE_EXPORT QgsAction
//! Whether to capture output for display when this action is run //! Whether to capture output for display when this action is run
bool capture() const { return mCaptureOutput; } bool capture() const { return mCaptureOutput; }


//! Returns true if the action should be shown on the attribute table
bool showInAttributeTable() const { return mShowInAttributeTable; }

//! Checks if the action is runable on the current platform //! Checks if the action is runable on the current platform
bool runable() const; bool runable() const;


Expand All @@ -85,7 +101,6 @@ class CORE_EXPORT QgsAction
QString mIcon; QString mIcon;
QString mAction; QString mAction;
bool mCaptureOutput; bool mCaptureOutput;
bool mShowInAttributeTable;
}; };


#endif // QGSACTION_H #endif // QGSACTION_H
5 changes: 2 additions & 3 deletions src/core/qgsactionmanager.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ bool QgsActionManager::writeXML( QDomNode& layer_node, QDomDocument& doc ) const
actionSetting.setAttribute( "shortTitle", action.shortTitle() ); actionSetting.setAttribute( "shortTitle", action.shortTitle() );
actionSetting.setAttribute( "icon", action.iconPath() ); actionSetting.setAttribute( "icon", action.iconPath() );
actionSetting.setAttribute( "action", action.action() ); actionSetting.setAttribute( "action", action.action() );
actionSetting.setAttribute( "showInAttributeTable", action.showInAttributeTable() );
actionSetting.setAttribute( "capture", action.capture() ); actionSetting.setAttribute( "capture", action.capture() );
aActions.appendChild( actionSetting ); aActions.appendChild( actionSetting );
} }
Expand All @@ -310,8 +309,8 @@ bool QgsActionManager::readXML( const QDomNode& layer_node )
setting.attributeNode( "action" ).value(), setting.attributeNode( "action" ).value(),
setting.attributeNode( "icon" ).value(), setting.attributeNode( "icon" ).value(),
setting.attributeNode( "capture" ).value().toInt() != 0, setting.attributeNode( "capture" ).value().toInt() != 0,
setting.attributeNode( "shortTitle" ).value(), setting.attributeNode( "shortTitle" ).value()
setting.attributeNode( "showInAttributeTable" ).value().toInt() != 0 ) )
); );
} }
} }
Expand Down
2 changes: 0 additions & 2 deletions src/gui/attributetable/qgsattributetabledelegate.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ class GUI_EXPORT QgsAttributeTableDelegate : public QItemDelegate
*/ */
void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override; void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;


void setLayer( QgsVectorLayer* layer );

/** /**
* Sets data from model into the editor. Overloads default method * Sets data from model into the editor. Overloads default method
* @param editor editor which was created by create editor function in this class * @param editor editor which was created by create editor function in this class
Expand Down
25 changes: 16 additions & 9 deletions src/gui/attributetable/qgsattributetablefiltermodel.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,29 +33,39 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub
Q_OBJECT Q_OBJECT


public: public:
/**
* The filter mode defines how the rows should be filtered.
*/
enum FilterMode enum FilterMode
{ {
ShowAll, ShowAll, //!< Show all features
ShowSelected, ShowSelected, //!< Show only selected features
ShowVisible, ShowVisible, //!< Show only visible features (depends on the map canvas)
ShowFilteredList, ShowFilteredList, //!< Show only features whose ids are on the filter list. {@see setFilteredFeatures}
ShowEdited ShowEdited //!< Show only features which have unsaved changes
}; };


/**
* The type of a column.
*/
enum ColumnType enum ColumnType
{ {
ColumnTypeField, //!< This column shows a field ColumnTypeField, //!< This column shows a field
ColumnTypeActionButton //!< This column shows action buttons ColumnTypeActionButton //!< This column shows action buttons
}; };


/**
* The additional roles defined by this filter model.
* The values of these roles start just after the roles defined by
* QgsAttributeTableModel so they do not conflict.
*/
enum Role enum Role
{ {
TypeRole = QgsAttributeTableModel::UserRole //!< The type of a given column TypeRole = QgsAttributeTableModel::UserRole //!< The type of a given column
}; };




/** /**
*
* Make sure, the master model is already loaded, so the selection will get synchronized. * Make sure, the master model is already loaded, so the selection will get synchronized.
* *
* @param parent parent object (owner) * @param parent parent object (owner)
Expand Down Expand Up @@ -112,8 +122,6 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub


/** /**
* The current filterModel * The current filterModel
*
* @return Mode
*/ */
FilterMode filterMode() { return mFilterMode; } FilterMode filterMode() { return mFilterMode; }


Expand Down Expand Up @@ -215,7 +223,6 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub
/** /**
* Is called upon every change of the visible extents on the map canvas. * Is called upon every change of the visible extents on the map canvas.
* When a change is signalled, the filter is updated and invalidated if needed. * When a change is signalled, the filter is updated and invalidated if needed.
*
*/ */
void extentsChanged(); void extentsChanged();


Expand Down

0 comments on commit c369aab

Please sign in to comment.