2017-06-20 11:14:25 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/composer/qgscomposermodel.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QgsComposerModel: QAbstractItemModel
|
2014-07-28 22:26:33 +10:00
|
|
|
{
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
|
|
|
|
A model for items attached to a composition. The model also maintains the z-order for the
|
|
|
|
composition, and must be notified whenever item stacking changes.
|
|
|
|
|
|
|
|
Internally, QgsComposerModel maintains two lists. One contains a complete list of all items for
|
|
|
|
the composition, ordered by their position within the z-order stack. This list also contains
|
|
|
|
items which have been removed from the composition, so that undo/redo commands can restore
|
|
|
|
them to their correct position in the stacking order.
|
|
|
|
|
|
|
|
The second list contains only items which are currently displayed in the composition's scene.
|
|
|
|
It is used as a cache of the last known stacking order, so that the model can compare the current
|
|
|
|
stacking of items in the composition to the last known state, and emit the corresponding signals
|
|
|
|
as required.
|
|
|
|
%End
|
|
|
|
|
2014-07-28 22:26:33 +10:00
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgscomposermodel.h"
|
|
|
|
%End
|
|
|
|
public:
|
2014-08-17 13:37:26 +02:00
|
|
|
|
2016-04-08 19:27:34 +10:00
|
|
|
enum Columns
|
|
|
|
{
|
2017-06-20 11:14:25 +02:00
|
|
|
Visibility,
|
|
|
|
LockStatus,
|
|
|
|
ItemId,
|
2016-04-08 19:27:34 +10:00
|
|
|
};
|
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
explicit QgsComposerModel( QgsComposition *composition, QObject *parent /TransferThis/ = 0 );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Constructor
|
|
|
|
\param composition composition to attach to
|
|
|
|
\param parent parent object
|
|
|
|
%End
|
|
|
|
|
|
|
|
virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
|
|
|
|
|
|
|
|
virtual QModelIndex parent( const QModelIndex &index ) const;
|
|
|
|
|
|
|
|
virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
|
|
|
|
|
|
|
|
virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const;
|
|
|
|
|
|
|
|
virtual QVariant data( const QModelIndex &index, int role ) const;
|
|
|
|
|
|
|
|
virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
|
|
|
|
|
|
|
|
virtual bool setData( const QModelIndex &index, const QVariant &value, int role );
|
|
|
|
|
|
|
|
virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
|
|
|
|
|
|
|
|
virtual Qt::DropActions supportedDropActions() const;
|
2014-07-28 22:26:33 +10:00
|
|
|
|
2015-02-03 02:21:52 +01:00
|
|
|
virtual QStringList mimeTypes() const;
|
2017-05-01 18:13:15 +02:00
|
|
|
virtual QMimeData *mimeData( const QModelIndexList &indexes ) const;
|
2017-06-20 11:14:25 +02:00
|
|
|
virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent );
|
|
|
|
|
|
|
|
virtual bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() );
|
|
|
|
|
2014-07-28 22:26:33 +10:00
|
|
|
|
|
|
|
void clear();
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Clears all items from z-order list and resets the model
|
|
|
|
.. versionadded:: 2.5
|
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
|
|
|
int zOrderListSize() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the size of the z-order list, which includes items which may
|
|
|
|
have been removed from the composition.
|
|
|
|
:return: size of z-order list
|
|
|
|
.. versionadded:: 2.5
|
|
|
|
:rtype: int
|
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
|
|
|
void rebuildZList();
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Rebuilds the z-order list, based on the current stacking of items in the composition.
|
|
|
|
This method should be called after adding multiple items to the composition.
|
|
|
|
.. versionadded:: 2.5
|
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
|
|
|
void addItemAtTop( QgsComposerItem *item );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Adds an item to the top of the composition z stack.
|
|
|
|
\param item item to add. The item must not already exist in the z-order list.
|
|
|
|
.. versionadded:: 2.5
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`reorderItemToTop`
|
2017-06-20 11:14:25 +02:00
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
|
|
|
void removeItem( QgsComposerItem *item );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Removes an item from the z-order list.
|
|
|
|
\param item item to remove
|
|
|
|
.. versionadded:: 2.5
|
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
|
|
|
bool reorderItemUp( QgsComposerItem *item );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Moves an item up the z-order list.
|
|
|
|
\param item item to move
|
|
|
|
:return: true if item was moved. Returns false if item was not found
|
|
|
|
in z-order list or was already at the top of the z-order list.
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`reorderItemDown`
|
|
|
|
.. seealso:: :py:func:`reorderItemToTop`
|
|
|
|
.. seealso:: :py:func:`reorderItemToBottom`
|
2017-06-20 11:14:25 +02:00
|
|
|
.. versionadded:: 2.5
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
|
|
|
bool reorderItemDown( QgsComposerItem *item );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Moves an item down the z-order list.
|
|
|
|
\param item item to move
|
|
|
|
:return: true if item was moved. Returns false if item was not found
|
|
|
|
in z-order list or was already at the bottom of the z-order list.
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`reorderItemUp`
|
|
|
|
.. seealso:: :py:func:`reorderItemToTop`
|
|
|
|
.. seealso:: :py:func:`reorderItemToBottom`
|
2017-06-20 11:14:25 +02:00
|
|
|
.. versionadded:: 2.5
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
|
|
|
bool reorderItemToTop( QgsComposerItem *item );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Moves an item to the top of the z-order list.
|
|
|
|
\param item item to move
|
|
|
|
:return: true if item was moved. Returns false if item was not found
|
|
|
|
in z-order list or was already at the top of the z-order list.
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`reorderItemUp`
|
|
|
|
.. seealso:: :py:func:`reorderItemDown`
|
|
|
|
.. seealso:: :py:func:`reorderItemToBottom`
|
2017-06-20 11:14:25 +02:00
|
|
|
.. versionadded:: 2.5
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
|
|
|
bool reorderItemToBottom( QgsComposerItem *item );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Moves an item to the bottom of the z-order list.
|
|
|
|
\param item item to move
|
|
|
|
:return: true if item was moved. Returns false if item was not found
|
|
|
|
in z-order list or was already at the bottom of the z-order list.
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`reorderItemUp`
|
|
|
|
.. seealso:: :py:func:`reorderItemDown`
|
|
|
|
.. seealso:: :py:func:`reorderItemToTop`
|
2017-06-20 11:14:25 +02:00
|
|
|
.. versionadded:: 2.5
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsComposerItem *getComposerItemAbove( QgsComposerItem *item ) const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Finds the next composer item above an item. This method only considers
|
|
|
|
items which are currently in the composition, and ignores items which have been
|
|
|
|
removed from the composition.
|
|
|
|
\param item item to search above
|
|
|
|
:return: item above specified item. If no items were found, no item
|
|
|
|
will be returned.
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`getComposerItemBelow`
|
2017-06-20 11:14:25 +02:00
|
|
|
.. versionadded:: 2.5
|
|
|
|
:rtype: QgsComposerItem
|
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsComposerItem *getComposerItemBelow( QgsComposerItem *item ) const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Finds the next composer item below an item. This method only considers
|
|
|
|
items which are currently in the composition, and ignores items which have been
|
|
|
|
removed from the composition.
|
|
|
|
\param item item to search above
|
|
|
|
:return: item below specified item. If no items were found, no item
|
|
|
|
will be returned.
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`getComposerItemAbove`
|
2017-06-20 11:14:25 +02:00
|
|
|
.. versionadded:: 2.5
|
|
|
|
:rtype: QgsComposerItem
|
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QList<QgsComposerItem *> *zOrderList();
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the item z-order list. This list includes both items currently in the
|
|
|
|
composition and items which have been removed from the composition.
|
|
|
|
:return: item z-order list
|
|
|
|
.. versionadded:: 2.5
|
|
|
|
:rtype: list of QgsComposerItem
|
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
|
|
|
void setItemRemoved( QgsComposerItem *item );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Marks an item as removed from the composition. This must be called whenever an item
|
|
|
|
has been removed from the composition.
|
|
|
|
\param item to mark as removed from the composition
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setItemRestored`
|
2017-06-20 11:14:25 +02:00
|
|
|
.. versionadded:: 2.5
|
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
|
|
|
void setItemRestored( QgsComposerItem *item );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Restores an item to the composition. This must be called whenever an item removed
|
|
|
|
from the composition is restored to the composition.
|
|
|
|
\param item to mark as restored to the composition
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setItemRemoved`
|
2017-06-20 11:14:25 +02:00
|
|
|
.. versionadded:: 2.5
|
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
|
|
|
void updateItemDisplayName( QgsComposerItem *item );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Must be called when an item's display name is modified
|
|
|
|
\param item item to update
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`updateItemLockStatus`
|
|
|
|
.. seealso:: :py:func:`updateItemVisibility`
|
|
|
|
.. seealso:: :py:func:`updateItemSelectStatus`
|
2017-06-20 11:14:25 +02:00
|
|
|
.. versionadded:: 2.5
|
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
|
|
|
void updateItemLockStatus( QgsComposerItem *item );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Must be called when an item's lock status changes
|
|
|
|
\param item item to update
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`updateItemDisplayName`
|
|
|
|
.. seealso:: :py:func:`updateItemVisibility`
|
|
|
|
.. seealso:: :py:func:`updateItemSelectStatus`
|
2017-06-20 11:14:25 +02:00
|
|
|
.. versionadded:: 2.5
|
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
|
|
|
void updateItemVisibility( QgsComposerItem *item );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Must be called when an item's visibility changes
|
|
|
|
\param item item to update
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`updateItemDisplayName`
|
|
|
|
.. seealso:: :py:func:`updateItemLockStatus`
|
|
|
|
.. seealso:: :py:func:`updateItemSelectStatus`
|
2017-06-20 11:14:25 +02:00
|
|
|
.. versionadded:: 2.5
|
|
|
|
%End
|
2014-07-28 22:26:33 +10:00
|
|
|
|
2015-02-03 02:21:52 +01:00
|
|
|
void updateItemSelectStatus( QgsComposerItem *item );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Must be called when an item's selection status changes
|
|
|
|
\param item item to update
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`updateItemDisplayName`
|
|
|
|
.. seealso:: :py:func:`updateItemVisibility`
|
|
|
|
.. seealso:: :py:func:`updateItemLockStatus`
|
2017-06-20 11:14:25 +02:00
|
|
|
.. versionadded:: 2.5
|
|
|
|
%End
|
2015-02-03 02:21:52 +01:00
|
|
|
|
2016-04-08 19:27:34 +10:00
|
|
|
QModelIndex indexForItem( QgsComposerItem *item, const int column = 0 );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the QModelIndex corresponding to a QgsComposerItem, if possible
|
|
|
|
\param item QgsComposerItem to find index for
|
|
|
|
\param column column number for created QModelIndex
|
|
|
|
:return: QModelIndex corresponding to item and specified column
|
|
|
|
:rtype: QModelIndex
|
|
|
|
%End
|
2016-04-08 19:27:34 +10:00
|
|
|
|
2014-07-28 22:26:33 +10:00
|
|
|
public slots:
|
2014-08-17 13:37:26 +02:00
|
|
|
|
2014-07-28 22:26:33 +10:00
|
|
|
void setSelected( const QModelIndex &index );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Sets an item as the current selection from a QModelIndex
|
|
|
|
\param index QModelIndex of item to set as selected
|
|
|
|
.. versionadded:: 2.5
|
|
|
|
%End
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-28 22:26:33 +10:00
|
|
|
};
|
2016-04-08 19:27:34 +10:00
|
|
|
|
|
|
|
|
|
|
|
class QgsComposerProxyModel: QSortFilterProxyModel
|
|
|
|
{
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Allows for filtering a QgsComposerModel by item type.
|
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
|
|
|
|
2016-04-08 19:27:34 +10:00
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgscomposermodel.h"
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
2017-05-02 07:21:20 +02:00
|
|
|
QgsComposerProxyModel( QgsComposition *composition, QObject *parent /TransferThis/ = 0 );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Constructor for QgsComposerProxyModel.
|
|
|
|
\param composition composition to attach model to
|
|
|
|
\param parent optional parent
|
|
|
|
%End
|
2016-04-08 19:27:34 +10:00
|
|
|
|
|
|
|
QgsComposerItem::ItemType filterType() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the current item type filter, or QgsComposerItem.ComposerItem if no
|
|
|
|
item type filter is set.
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setFilterType()`
|
2017-06-20 11:14:25 +02:00
|
|
|
:rtype: QgsComposerItem.ItemType
|
|
|
|
%End
|
2016-04-08 19:27:34 +10:00
|
|
|
|
|
|
|
void setFilterType( QgsComposerItem::ItemType itemType );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Sets the item type filter. Only matching item types will be shown.
|
|
|
|
\param itemType type to filter. Set to QgsComposerItem.ComposerItem to show all
|
|
|
|
item types.
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`filterType()`
|
2017-06-20 11:14:25 +02:00
|
|
|
%End
|
2016-04-08 19:27:34 +10:00
|
|
|
|
2017-06-20 11:14:25 +02:00
|
|
|
void setExceptedItemList( const QList< QgsComposerItem * > &exceptList );
|
|
|
|
%Docstring
|
|
|
|
Sets a list of specific items to exclude from the model
|
|
|
|
\param exceptList list of items to exclude
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`exceptedItemList()`
|
2017-06-20 11:14:25 +02:00
|
|
|
%End
|
2016-04-08 19:27:34 +10:00
|
|
|
|
2017-06-20 11:14:25 +02:00
|
|
|
QList< QgsComposerItem * > exceptedItemList() const;
|
|
|
|
%Docstring
|
|
|
|
Returns the list of specific items excluded from the model.
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setExceptedItemList()`
|
2017-06-20 11:14:25 +02:00
|
|
|
:rtype: list of QgsComposerItem
|
|
|
|
%End
|
2016-04-08 19:27:34 +10:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsComposerModel *sourceLayerModel() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the QgsComposerModel used in this proxy model.
|
|
|
|
:rtype: QgsComposerModel
|
|
|
|
%End
|
2016-04-08 19:27:34 +10:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsComposerItem *itemFromSourceIndex( const QModelIndex &sourceIndex ) const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the QgsComposerItem corresponding to an index from the source
|
|
|
|
QgsComposerModel model.
|
|
|
|
\param sourceIndex a QModelIndex
|
|
|
|
:return: QgsComposerItem for specified index from QgsComposerModel
|
|
|
|
:rtype: QgsComposerItem
|
|
|
|
%End
|
2016-04-08 19:27:34 +10:00
|
|
|
|
|
|
|
protected:
|
2017-06-20 11:14:25 +02:00
|
|
|
virtual bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const;
|
|
|
|
|
|
|
|
virtual bool lessThan( const QModelIndex &left, const QModelIndex &right ) const;
|
|
|
|
|
2016-04-08 19:27:34 +10:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2017-06-20 11:14:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/composer/qgscomposermodel.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|