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
@@ -1,5 +1,5 @@
/***************************************************************************
qgsattributemanager.h
qgsactionmanager.sip

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

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

Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsattributetableconfig.sip
@@ -1,5 +1,5 @@
/***************************************************************************
qgsattributetableconfig.h - QgsAttributeTableConfig
qgsattributetableconfig.sip

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

/**
* The type of a column.
*/
enum ColumnType
{
ColumnTypeField, //!< This column shows a field
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
{
TypeRole = QgsAttributeTableModel::UserRole //!< The type of a given column
};


/**
*
* Make sure, the master model is already loaded, so the selection will get synchronized.
*
* @param parent parent object (owner)
Expand All @@ -35,6 +45,13 @@ class QgsAttributeTableFilterModel: QSortFilterProxyModel, QgsFeatureModel
*/
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 );

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

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

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

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

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

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*/
QgsMapCanvas* mapCanvas() const;

Expand Down Expand Up @@ -151,20 +185,10 @@ class QgsAttributeTableFilterModel: QSortFilterProxyModel, QgsFeatureModel
*/
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:
/**
* 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.
*
*/
void extentsChanged();

Expand Down
27 changes: 21 additions & 6 deletions src/core/qgsaction.h
Expand Up @@ -35,26 +35,45 @@ class CORE_EXPORT QgsAction
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 )
: mType( type )
, mDescription( description )
, mAction( action )
, 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 )
, mDescription( description )
, mShortTitle( shortTitle )
, mIcon( icon )
, mAction( action )
, mCaptureOutput( capture )
, mShowInAttributeTable( showInAttributeTable )
{}

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

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

//! 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
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
bool runable() const;

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

#endif // QGSACTION_H
5 changes: 2 additions & 3 deletions src/core/qgsactionmanager.cpp
Expand Up @@ -283,7 +283,6 @@ bool QgsActionManager::writeXML( QDomNode& layer_node, QDomDocument& doc ) const
actionSetting.setAttribute( "shortTitle", action.shortTitle() );
actionSetting.setAttribute( "icon", action.iconPath() );
actionSetting.setAttribute( "action", action.action() );
actionSetting.setAttribute( "showInAttributeTable", action.showInAttributeTable() );
actionSetting.setAttribute( "capture", action.capture() );
aActions.appendChild( actionSetting );
}
Expand All @@ -310,8 +309,8 @@ bool QgsActionManager::readXML( const QDomNode& layer_node )
setting.attributeNode( "action" ).value(),
setting.attributeNode( "icon" ).value(),
setting.attributeNode( "capture" ).value().toInt() != 0,
setting.attributeNode( "shortTitle" ).value(),
setting.attributeNode( "showInAttributeTable" ).value().toInt() != 0 )
setting.attributeNode( "shortTitle" ).value()
)
);
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/gui/attributetable/qgsattributetabledelegate.h
Expand Up @@ -68,8 +68,6 @@ class GUI_EXPORT QgsAttributeTableDelegate : public QItemDelegate
*/
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
* @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
Expand Up @@ -33,29 +33,39 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub
Q_OBJECT

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

/**
* The type of a column.
*/
enum ColumnType
{
ColumnTypeField, //!< This column shows a field
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
{
TypeRole = QgsAttributeTableModel::UserRole //!< The type of a given column
};


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

/**
* The current filterModel
*
* @return Mode
*/
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.
* When a change is signalled, the filter is updated and invalidated if needed.
*
*/
void extentsChanged();

Expand Down

0 comments on commit c369aab

Please sign in to comment.