QGIS/python/core/layout/qgslayoutguidecollection.sip

299 lines
7.8 KiB
Plaintext
Raw Normal View History

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutguidecollection.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2017-07-25 19:19:36 +10:00
class QgsLayoutGuide : QObject
{
%Docstring
Contains the configuration for a single snap guide used by a layout.
2017-12-15 10:36:55 -04:00
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgslayoutguidecollection.h"
%End
public:
QgsLayoutGuide( Qt::Orientation orientation, const QgsLayoutMeasurement &position, QgsLayoutItemPage *page );
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for a new guide with the specified ``orientation`` and
initial ``position``.
2017-12-15 10:36:55 -04:00
A layout must be set by calling setLayout() before the guide can be used.
Adding the guide to a QgsLayoutGuideCollection will automatically set
the corresponding layout for you.
%End
2017-08-07 22:31:44 +10:00
~QgsLayoutGuide();
QgsLayout *layout() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the layout the guide belongs to.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setLayout()`
%End
void setLayout( QgsLayout *layout );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the ``layout`` the guide belongs to.
.. note::
Adding the guide to a QgsLayoutGuideCollection will automatically set
2017-12-15 10:36:55 -04:00
the corresponding layout for you.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`layout()`
%End
Qt::Orientation orientation() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the guide's orientation.
%End
QgsLayoutMeasurement position() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the guide's position within the page.
2017-12-15 10:36:55 -04:00
The position indicates either the horizontal or vertical position
of the guide, depending on the guide's orientation().
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setPosition()`
%End
void setPosition( const QgsLayoutMeasurement &position );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the guide's ``position`` within the page.
2017-12-15 10:36:55 -04:00
The ``position`` argument indicates either the horizontal or vertical position
of the guide, depending on the guide's orientation().
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`position()`
%End
2017-08-07 22:31:44 +10:00
QgsLayoutItemPage *page();
%Docstring
2017-12-15 10:36:55 -04:00
Returns the page the guide is contained within.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setPage()`
%End
2017-08-07 22:31:44 +10:00
void setPage( QgsLayoutItemPage *page );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the ``page`` the guide is contained within.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`page()`
%End
void update();
%Docstring
2017-12-15 10:36:55 -04:00
Updates the position of the guide's line item.
%End
QGraphicsLineItem *item();
%Docstring
2017-12-15 10:36:55 -04:00
Returns the guide's line item.
%End
double layoutPosition() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the guide's position in absolute layout units.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setLayoutPosition()`
%End
void setLayoutPosition( double position );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the guide's ``position`` in absolute layout units.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`layoutPosition()`
%End
signals:
void positionChanged();
%Docstring
2017-12-15 10:36:55 -04:00
Emitted when the guide's position is changed.
%End
};
class QgsLayoutGuideCollection : QAbstractTableModel, QgsLayoutSerializableObject
{
%Docstring
Stores and manages the snap guides used by a layout.
2017-12-15 10:36:55 -04:00
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgslayoutguidecollection.h"
%End
public:
enum Roles
{
OrientationRole,
PositionRole,
UnitsRole,
PageRole,
LayoutPositionRole,
};
2017-08-07 22:31:44 +10:00
QgsLayoutGuideCollection( QgsLayout *layout, QgsLayoutPageCollection *pageCollection );
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsLayoutGuideCollection belonging to the specified layout,
and linked to the specified ``pageCollection``.
%End
~QgsLayoutGuideCollection();
virtual QString stringType() const;
virtual QgsLayout *layout();
virtual int rowCount( const QModelIndex & ) const;
2017-07-25 23:01:10 +10:00
virtual int columnCount( const QModelIndex & ) const;
virtual QVariant data( const QModelIndex &index, int role ) const;
virtual bool setData( const QModelIndex &index, const QVariant &value, int role );
virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
2017-07-25 23:12:48 +10:00
virtual QVariant headerData( int section, Qt::Orientation orientation,
int role = Qt::DisplayRole ) const;
virtual bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() );
void addGuide( QgsLayoutGuide *guide /Transfer/ );
%Docstring
2017-12-15 10:36:55 -04:00
Adds a ``guide`` to the collection. Ownership of the guide is transferred to the
collection, and the guide will automatically have the correct layout
set.
%End
void removeGuide( QgsLayoutGuide *guide );
%Docstring
2017-12-15 10:36:55 -04:00
Removes the specified ``guide``, and deletes it.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`clear()`
2017-07-26 21:21:57 +10:00
%End
void setGuideLayoutPosition( QgsLayoutGuide *guide, double position );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the absolute ``position`` (in layout coordinates) for ``guide`` within the layout.
%End
2017-07-26 21:21:57 +10:00
void clear();
%Docstring
2017-12-15 10:36:55 -04:00
Removes all guides from the collection.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`removeGuide()`
%End
void applyGuidesToAllOtherPages( int sourcePage );
%Docstring
2017-12-15 10:36:55 -04:00
Resets all other pages' guides to match the guides from the specified ``sourcePage``.
%End
void update();
%Docstring
2017-12-15 10:36:55 -04:00
Updates the position (and visibility) of all guide line items.
%End
QList< QgsLayoutGuide * > guides( Qt::Orientation orientation, int page = -1 );
%Docstring
2017-12-15 10:36:55 -04:00
Returns the list of guides contained in the collection with the specified
``orientation`` and on a matching ``page``.
If ``page`` is -1, guides from all pages will be returned.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`guidesOnPage()`
%End
2017-08-07 22:31:44 +10:00
QList< QgsLayoutGuide * > guidesOnPage( int page );
%Docstring
2017-12-15 10:36:55 -04:00
Returns the list of guides contained on a matching ``page``.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`guides()`
2017-08-07 22:31:44 +10:00
%End
2017-07-27 12:01:59 +10:00
bool visible() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if the guide lines should be drawn.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setVisible()`
2017-07-27 12:01:59 +10:00
%End
void setVisible( bool visible );
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether the guide lines should be ``visible``.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`visible()`
2017-07-27 12:01:59 +10:00
%End
virtual bool writeXml( QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Stores the collection's state in a DOM element. The ``parentElement`` should refer to the parent layout's DOM element.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`readXml()`
%End
virtual bool readXml( const QDomElement &collectionElement, const QDomDocument &document, const QgsReadWriteContext &context );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the collection's state from a DOM element. collectionElement is the DOM node corresponding to the collection.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`writeXml()`
%End
};
class QgsLayoutGuideProxyModel : QSortFilterProxyModel
{
%Docstring
Filters QgsLayoutGuideCollection models to guides of a single orientation (horizontal or vertical).
2017-12-15 10:36:55 -04:00
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgslayoutguidecollection.h"
%End
public:
explicit QgsLayoutGuideProxyModel( QObject *parent /TransferThis/, Qt::Orientation orientation, int page );
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsLayoutGuideProxyModel, filtered to guides of the specified ``orientation`` and ``page`` only.
2017-12-15 10:36:55 -04:00
Page numbers begin at 0.
%End
void setPage( int page );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the current ``page`` for filtering matching guides. Page numbers begin at 0.
%End
virtual bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const;
virtual bool lessThan( const QModelIndex &left, const QModelIndex &right ) const;
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutguidecollection.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/