QGIS/python/core/layout/qgslayoutitempicture.sip

349 lines
8.5 KiB
Plaintext
Raw Normal View History

2017-10-23 17:05:46 +10:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutitempicture.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsLayoutItemPicture: QgsLayoutItem
{
%Docstring
2017-12-15 10:36:55 -04:00
A layout item subclass that displays SVG files or raster format images (jpg, png, ...).
2017-10-23 17:05:46 +10:00
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgslayoutitempicture.h"
%End
public:
enum ResizeMode
{
Zoom,
Stretch,
Clip,
ZoomResizeFrame,
FrameToImageSize
};
enum Format
{
FormatSVG,
FormatRaster,
FormatUnknown,
};
enum NorthMode
{
GridNorth,
TrueNorth,
};
QgsLayoutItemPicture( QgsLayout *layout );
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsLayoutItemPicture, with the specified parent ``layout``.
2017-10-23 17:05:46 +10:00
%End
virtual int type() const;
static QgsLayoutItemPicture *create( QgsLayout *layout ) /Factory/;
%Docstring
2017-12-15 10:36:55 -04:00
Returns a new picture item for the specified ``layout``.
The caller takes responsibility for deleting the returned object.
2017-10-23 17:05:46 +10:00
2017-12-15 10:36:55 -04:00
:rtype: QgsLayoutItemPicture
2017-10-23 17:05:46 +10:00
%End
void setPicturePath( const QString &path );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the source ``path`` of the image (may be svg or a raster format). Data defined
picture source may override this value. The path can either be a local path
or a remote (http) path.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`picturePath()`
2017-10-23 17:05:46 +10:00
%End
QString picturePath() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the path of the source image. Data defined picture source may override
this value. The path can either be a local path or a remote (http) path.
:return: path for the source image
:rtype: str
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`usePictureExpression()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setPicturePath()`
2017-10-23 17:05:46 +10:00
%End
double pictureRotation() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the rotation used for drawing the picture within the item's frame,
in degrees clockwise.
:rtype: float
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setPictureRotation()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`rotationMap()`
2017-10-23 17:05:46 +10:00
%End
void setRotationMap( const QString &uuid );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the map object for rotation (by ``uuid``). A empty string disables the map
rotation. If this is set then the picture will be rotated by the same
amount as the specified map object. This is useful especially for
syncing north arrows with a map item.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setPictureRotation()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`rotationMap()`
2017-10-23 17:05:46 +10:00
%End
QString rotationMap() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the uuid of the rotation map. An empty string means map rotation is
disabled. If this is set then the picture is rotated by the same amount
as the specified map object.
:rtype: str
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setRotationMap()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`useRotationMap()`
2017-10-23 17:05:46 +10:00
%End
bool useRotationMap() const;
%Docstring
2017-12-15 10:36:55 -04:00
True if the picture rotation is matched to a map item.
:rtype: bool
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`rotationMap()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setRotationMap()`
2017-10-23 17:05:46 +10:00
%End
NorthMode northMode() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the mode used to align the picture to a map's North.
:rtype: NorthMode
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setNorthMode()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`northOffset()`
2017-10-23 17:05:46 +10:00
%End
void setNorthMode( NorthMode mode );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the ``mode`` used to align the picture to a map's North.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`northMode()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setNorthOffset()`
2017-10-23 17:05:46 +10:00
%End
double northOffset() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the offset added to the picture's rotation from a map's North.
:rtype: float
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setNorthOffset()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`northMode()`
2017-10-23 17:05:46 +10:00
%End
void setNorthOffset( double offset );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the ``offset`` added to the picture's rotation from a map's North.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`northOffset()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setNorthMode()`
2017-10-23 17:05:46 +10:00
%End
ResizeMode resizeMode() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the resize mode used for drawing the picture within the composer
item's frame.
:rtype: ResizeMode
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setResizeMode()`
2017-10-23 17:05:46 +10:00
%End
void setPictureAnchor( QgsLayoutItem::ReferencePoint anchor );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the picture's ``anchor`` point, which controls how it is placed
within the picture item's frame.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`pictureAnchor()`
2017-10-23 17:05:46 +10:00
%End
QgsLayoutItem::ReferencePoint pictureAnchor() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the picture's current anchor, which controls how it is placed
within the picture item's frame.
:rtype: QgsLayoutItem.ReferencePoint
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setPictureAnchor()`
2017-10-23 17:05:46 +10:00
%End
QColor svgFillColor() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the fill color used for parametrized SVG files.
:rtype: QColor
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setSvgFillColor()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`svgStrokeColor()`
2017-10-23 17:05:46 +10:00
%End
void setSvgFillColor( const QColor &color );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the fill ``color`` used for parametrized SVG files.
2017-10-23 17:05:46 +10:00
.. note::
This setting only has an effect on parametrized SVG files, and is ignored for
2017-12-15 10:36:55 -04:00
non-parametrized SVG files.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`svgFillColor()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setSvgStrokeColor()`
2017-10-23 17:05:46 +10:00
%End
QColor svgStrokeColor() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the stroke color used for parametrized SVG files.
:rtype: QColor
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setSvgStrokeColor()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`svgFillColor()`
2017-10-23 17:05:46 +10:00
%End
void setSvgStrokeColor( const QColor &color );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the stroke ``color`` used for parametrized SVG files.
:param color: stroke color.
2017-10-23 17:05:46 +10:00
.. note::
This setting only has an effect on parametrized SVG files, and is ignored for
2017-12-15 10:36:55 -04:00
non-parametrized SVG files.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`svgStrokelColor()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setSvgFillColor()`
2017-10-23 17:05:46 +10:00
%End
double svgStrokeWidth() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the stroke width (in layout units) used for parametrized SVG files.
:rtype: float
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setSvgStrokeWidth()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`svgStrokeColor()`
2017-10-23 17:05:46 +10:00
%End
void setSvgStrokeWidth( double width );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the stroke ``width`` (in layout units) used for parametrized SVG files.
2017-10-23 17:05:46 +10:00
.. note::
This setting only has an effect on parametrized SVG files, and is ignored for
2017-12-15 10:36:55 -04:00
non-parametrized SVG files.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`svgStrokeWidth()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setSvgStrokeColor()`
2017-10-23 17:05:46 +10:00
%End
Format mode() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the current picture mode (image format).
:rtype: Format
2017-10-23 17:05:46 +10:00
%End
virtual void finalizeRestoreFromXml();
2017-10-23 17:05:46 +10:00
public slots:
void setPictureRotation( double rotation );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the picture ``rotation`` within the item bounds, in degrees clockwise. This does not affect
the item's frame, only the way the picture is drawn within the item.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`pictureRotation()`
2017-10-23 17:05:46 +10:00
%End
void setResizeMode( ResizeMode mode );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the resize ``mode`` used for drawing the picture within the item bounds.
:param mode: ResizeMode to use for image file
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`resizeMode`
2017-10-23 17:05:46 +10:00
%End
void refreshPicture( const QgsExpressionContext *context = 0 );
%Docstring
2017-12-15 10:36:55 -04:00
Recalculates the source image (if using an expression for picture's source)
and reloads and redraws the picture.
:param context: expression context for evaluating data defined picture sources
2017-10-23 17:05:46 +10:00
%End
void recalculateSize();
%Docstring
2017-12-15 10:36:55 -04:00
Forces a recalculation of the picture's frame size
2017-10-23 17:05:46 +10:00
%End
virtual void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties );
signals:
void pictureRotationChanged( double newRotation );
%Docstring
Is emitted on picture rotation change
%End
protected:
virtual void draw( QgsRenderContext &context, const QStyleOptionGraphicsItem *itemStyle = 0 );
virtual QSizeF applyItemSizeConstraint( const QSizeF &targetSize );
2017-10-23 17:21:18 +10:00
virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;
virtual bool readPropertiesFromElement( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context );
2017-10-23 17:05:46 +10:00
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutitempicture.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/