QGIS/python/core/auto_generated/layout/qgslayoutsnapper.sip.in

262 lines
9.3 KiB
Plaintext
Raw Normal View History

2017-07-24 08:12:07 +10:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutsnapper.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsLayoutSnapper: QgsLayoutSerializableObject
2017-07-24 08:12:07 +10:00
{
%Docstring
Manages snapping grids and preset snap lines in a layout, and handles
2017-12-15 10:36:55 -04:00
snapping points to the nearest grid coordinate/snap line when possible.
2017-07-24 08:12:07 +10:00
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgslayoutsnapper.h"
%End
public:
QgsLayoutSnapper( QgsLayout *layout );
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsLayoutSnapper, attached to the specified ``layout``.
%End
virtual QString stringType() const;
virtual QgsLayout *layout();
void setSnapTolerance( int snapTolerance );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the snap ``tolerance`` (in pixels) to use when snapping.
.. seealso:: :py:func:`snapTolerance`
%End
int snapTolerance() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the snap tolerance (in pixels) to use when snapping.
.. seealso:: :py:func:`setSnapTolerance`
%End
2017-07-24 08:12:07 +10:00
bool snapToGrid() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if snapping to grid is enabled.
.. seealso:: :py:func:`setSnapToGrid`
%End
void setSnapToGrid( bool enabled );
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether snapping to grid is ``enabled``.
.. seealso:: :py:func:`snapToGrid`
2017-07-27 12:12:33 +10:00
%End
bool snapToGuides() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if snapping to guides is enabled.
.. seealso:: :py:func:`setSnapToGuides`
2017-07-27 12:12:33 +10:00
%End
void setSnapToGuides( bool enabled );
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether snapping to guides is ``enabled``.
.. seealso:: :py:func:`snapToGuides`
%End
bool snapToItems() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if snapping to items is enabled.
.. seealso:: :py:func:`setSnapToItems`
%End
void setSnapToItems( bool enabled );
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether snapping to items is ``enabled``.
.. seealso:: :py:func:`snapToItems`
%End
QPointF snapPoint( QPointF point, double scaleFactor, bool &snapped /Out/, QGraphicsLineItem *horizontalSnapLine = 0,
QGraphicsLineItem *verticalSnapLine = 0,
const QList< QgsLayoutItem * > *ignoreItems = 0 ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Snaps a layout coordinate ``point``. If ``point`` was snapped, ``snapped`` will be set to true.
2017-12-15 10:36:55 -04:00
The ``scaleFactor`` argument should be set to the transformation from
scalar transform from layout coordinates to pixels, i.e. the
graphics view transform().m11() value.
2017-12-15 10:36:55 -04:00
This method considers snapping to the grid, snap lines, etc.
2017-12-15 10:36:55 -04:00
If the ``horizontalSnapLine`` and ``verticalSnapLine`` arguments are specified, then the snapper
will automatically display and position these lines to indicate snapping positions to item bounds.
2017-12-15 10:36:55 -04:00
A list of items to ignore during the snapping can be specified via the ``ignoreItems`` list.
.. seealso:: :py:func:`snapRect`
%End
2017-10-02 22:04:58 +10:00
QRectF snapRect( const QRectF &rect, double scaleFactor, bool &snapped /Out/, QGraphicsLineItem *horizontalSnapLine = 0,
QGraphicsLineItem *verticalSnapLine = 0,
const QList< QgsLayoutItem * > *ignoreItems = 0 ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Snaps a layout coordinate ``rect``. If ``rect`` was snapped, ``snapped`` will be set to true.
Snapping occurs by moving the rectangle alone. The rectangle will not be resized
as a result of the snap operation.
2017-10-02 22:04:58 +10:00
2017-12-15 10:36:55 -04:00
The ``scaleFactor`` argument should be set to the transformation from
scalar transform from layout coordinates to pixels, i.e. the
graphics view transform().m11() value.
2017-10-02 22:04:58 +10:00
2017-12-15 10:36:55 -04:00
This method considers snapping to the grid, snap lines, etc.
2017-10-02 22:04:58 +10:00
2017-12-15 10:36:55 -04:00
If the ``horizontalSnapLine`` and ``verticalSnapLine`` arguments are specified, then the snapper
will automatically display and position these lines to indicate snapping positions to item bounds.
2017-10-02 22:04:58 +10:00
2017-12-15 10:36:55 -04:00
A list of items to ignore during the snapping can be specified via the ``ignoreItems`` list.
2017-10-02 22:04:58 +10:00
.. seealso:: :py:func:`snapPoint`
2017-10-02 22:04:58 +10:00
%End
QPointF snapPointToGrid( QPointF point, double scaleFactor, bool &snappedX /Out/, bool &snappedY /Out/ ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Snaps a layout coordinate ``point`` to the grid. If ``point``
was snapped horizontally, ``snappedX`` will be set to true. If ``point``
was snapped vertically, ``snappedY`` will be set to true.
The ``scaleFactor`` argument should be set to the transformation from
scalar transform from layout coordinates to pixels, i.e. the
graphics view transform().m11() value.
2017-12-15 10:36:55 -04:00
If snapToGrid() is disabled, this method will return the point
unchanged.
.. seealso:: :py:func:`snapPointsToGrid`
2017-10-02 22:04:58 +10:00
%End
QPointF snapPointsToGrid( const QList< QPointF > &points, double scaleFactor, bool &snappedX /Out/, bool &snappedY /Out/ ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Snaps a set of ``points`` to the grid. If the points
were snapped, ``snapped`` will be set to true.
2017-10-02 22:04:58 +10:00
2017-12-15 10:36:55 -04:00
The ``scaleFactor`` argument should be set to the transformation from
scalar transform from layout coordinates to pixels, i.e. the
graphics view transform().m11() value.
2017-10-02 22:04:58 +10:00
2017-12-15 10:36:55 -04:00
If snapToGrid() is disabled, this method will not attempt to snap the points.
2017-10-02 22:04:58 +10:00
2017-12-15 10:36:55 -04:00
The returned value is the smallest delta which the points need to be shifted by in order to align
one of the points to the grid.
.. seealso:: :py:func:`snapPointToGrid`
%End
double snapPointToGuides( double original, Qt::Orientation orientation, double scaleFactor, bool &snapped /Out/ ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Snaps an ``original`` layout coordinate to the guides. If the point
was snapped, ``snapped`` will be set to true.
The ``scaleFactor`` argument should be set to the transformation from
scalar transform from layout coordinates to pixels, i.e. the
graphics view transform().m11() value.
2017-12-15 10:36:55 -04:00
If snapToGuides() is disabled, this method will return the point
unchanged.
.. seealso:: :py:func:`snapPointsToGuides`
2017-10-02 22:04:58 +10:00
%End
double snapPointsToGuides( const QList< double > &points, Qt::Orientation orientation, double scaleFactor, bool &snapped /Out/ ) const;
2017-10-02 22:04:58 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Snaps a set of ``points`` to the guides. If the points
were snapped, ``snapped`` will be set to true.
The ``scaleFactor`` argument should be set to the transformation from
scalar transform from layout coordinates to pixels, i.e. the
graphics view transform().m11() value.
2017-10-02 22:04:58 +10:00
2017-12-15 10:36:55 -04:00
If snapToGuides() is disabled, this method will not attempt to snap the points.
2017-10-02 22:04:58 +10:00
2017-12-15 10:36:55 -04:00
The returned value is the smallest delta which the points need to be shifted by in order to align
one of the points to a guide.
2017-10-02 22:04:58 +10:00
.. seealso:: :py:func:`snapPointToGuides`
%End
double snapPointToItems( double original, Qt::Orientation orientation, double scaleFactor, const QList< QgsLayoutItem * > &ignoreItems, bool &snapped /Out/,
QGraphicsLineItem *snapLine = 0 ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Snaps an ``original`` layout coordinate to the item bounds. If the point
was snapped, ``snapped`` will be set to true.
2017-12-15 10:36:55 -04:00
The ``scaleFactor`` argument should be set to the transformation from
scalar transform from layout coordinates to pixels, i.e. the
graphics view transform().m11() value.
2017-12-15 10:36:55 -04:00
If snapToItems() is disabled, this method will return the point
unchanged.
2017-12-15 10:36:55 -04:00
A list of items to ignore during the snapping can be specified via the ``ignoreItems`` list.
2017-12-15 10:36:55 -04:00
If ``snapLine`` is specified, the snapper will automatically show (or hide) the snap line
based on the result of the snap, and position it at the correct location for the snap.
.. seealso:: :py:func:`snapPointsToItems`
2017-10-02 22:04:58 +10:00
%End
double snapPointsToItems( const QList< double > &points, Qt::Orientation orientation, double scaleFactor, const QList< QgsLayoutItem * > &ignoreItems, bool &snapped /Out/,
QGraphicsLineItem *snapLine = 0 ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Snaps a set of ``points`` to the item bounds. If the points
were snapped, ``snapped`` will be set to true.
The ``scaleFactor`` argument should be set to the transformation from
scalar transform from layout coordinates to pixels, i.e. the
graphics view transform().m11() value.
2017-10-02 22:04:58 +10:00
2017-12-15 10:36:55 -04:00
If snapToItems() is disabled, this method will not attempt to snap the points.
2017-10-02 22:04:58 +10:00
2017-12-15 10:36:55 -04:00
The returned value is the smallest delta which the points need to be shifted by in order to align
one of the points to an item bound.
2017-10-02 22:04:58 +10:00
.. seealso:: :py:func:`snapPointToItems`
%End
virtual bool writeXml( QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Stores the snapper's state in a DOM element. The ``parentElement`` should refer to the parent layout's DOM element.
.. seealso:: :py:func:`readXml`
%End
virtual bool readXml( const QDomElement &gridElement, const QDomDocument &document, const QgsReadWriteContext &context );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the snapper's state from a DOM element. snapperElement is the DOM node corresponding to the snapper.
.. seealso:: :py:func:`writeXml`
%End
2017-07-24 08:12:07 +10:00
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutsnapper.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/