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