|
| 1 | +/************************************************************************ |
| 2 | + * This file has been generated automatically from * |
| 3 | + * * |
| 4 | + * src/core/layout/qgslayoutitempicture.h * |
| 5 | + * * |
| 6 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 7 | + ************************************************************************/ |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +class QgsLayoutItemPicture: QgsLayoutItem |
| 13 | +{ |
| 14 | +%Docstring |
| 15 | + A layout item subclass that displays SVG files or raster format images (jpg, png, ...). |
| 16 | +.. versionadded:: 3.0 |
| 17 | +%End |
| 18 | + |
| 19 | +%TypeHeaderCode |
| 20 | +#include "qgslayoutitempicture.h" |
| 21 | +%End |
| 22 | + public: |
| 23 | + |
| 24 | + enum ResizeMode |
| 25 | + { |
| 26 | + Zoom, |
| 27 | + Stretch, |
| 28 | + Clip, |
| 29 | + ZoomResizeFrame, |
| 30 | + FrameToImageSize |
| 31 | + }; |
| 32 | + |
| 33 | + enum Format |
| 34 | + { |
| 35 | + FormatSVG, |
| 36 | + FormatRaster, |
| 37 | + FormatUnknown, |
| 38 | + }; |
| 39 | + |
| 40 | + enum NorthMode |
| 41 | + { |
| 42 | + GridNorth, |
| 43 | + TrueNorth, |
| 44 | + }; |
| 45 | + |
| 46 | + QgsLayoutItemPicture( QgsLayout *layout ); |
| 47 | +%Docstring |
| 48 | + Constructor for QgsLayoutItemPicture, with the specified parent ``layout``. |
| 49 | +%End |
| 50 | + |
| 51 | + virtual int type() const; |
| 52 | + |
| 53 | + virtual QString stringType() const; |
| 54 | + |
| 55 | + |
| 56 | + static QgsLayoutItemPicture *create( QgsLayout *layout ) /Factory/; |
| 57 | +%Docstring |
| 58 | + Returns a new picture item for the specified ``layout``. |
| 59 | + |
| 60 | + The caller takes responsibility for deleting the returned object. |
| 61 | + :rtype: QgsLayoutItemPicture |
| 62 | +%End |
| 63 | + |
| 64 | + |
| 65 | + void setPicturePath( const QString &path ); |
| 66 | +%Docstring |
| 67 | + Sets the source ``path`` of the image (may be svg or a raster format). Data defined |
| 68 | + picture source may override this value. The path can either be a local path |
| 69 | + or a remote (http) path. |
| 70 | +.. seealso:: picturePath() |
| 71 | +%End |
| 72 | + |
| 73 | + QString picturePath() const; |
| 74 | +%Docstring |
| 75 | + Returns the path of the source image. Data defined picture source may override |
| 76 | + this value. The path can either be a local path or a remote (http) path. |
| 77 | + :return: path for the source image |
| 78 | +.. seealso:: usePictureExpression() |
| 79 | +.. seealso:: setPicturePath() |
| 80 | + :rtype: str |
| 81 | +%End |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + double pictureRotation() const; |
| 87 | +%Docstring |
| 88 | + Returns the rotation used for drawing the picture within the item's frame, |
| 89 | + in degrees clockwise. |
| 90 | +.. seealso:: setPictureRotation() |
| 91 | +.. seealso:: rotationMap() |
| 92 | + :rtype: float |
| 93 | +%End |
| 94 | + |
| 95 | + void setRotationMap( const QString &uuid ); |
| 96 | +%Docstring |
| 97 | + Sets the map object for rotation (by ``uuid``). A empty string disables the map |
| 98 | + rotation. If this is set then the picture will be rotated by the same |
| 99 | + amount as the specified map object. This is useful especially for |
| 100 | + syncing north arrows with a map item. |
| 101 | +.. seealso:: setPictureRotation() |
| 102 | +.. seealso:: rotationMap() |
| 103 | +%End |
| 104 | + |
| 105 | + QString rotationMap() const; |
| 106 | +%Docstring |
| 107 | + Returns the uuid of the rotation map. An empty string means map rotation is |
| 108 | + disabled. If this is set then the picture is rotated by the same amount |
| 109 | + as the specified map object. |
| 110 | +.. seealso:: setRotationMap() |
| 111 | +.. seealso:: useRotationMap() |
| 112 | + :rtype: str |
| 113 | +%End |
| 114 | + |
| 115 | + bool useRotationMap() const; |
| 116 | +%Docstring |
| 117 | + True if the picture rotation is matched to a map item. |
| 118 | +.. seealso:: rotationMap() |
| 119 | +.. seealso:: setRotationMap() |
| 120 | + :rtype: bool |
| 121 | +%End |
| 122 | + |
| 123 | + NorthMode northMode() const; |
| 124 | +%Docstring |
| 125 | + Returns the mode used to align the picture to a map's North. |
| 126 | +.. seealso:: setNorthMode() |
| 127 | +.. seealso:: northOffset() |
| 128 | + :rtype: NorthMode |
| 129 | +%End |
| 130 | + |
| 131 | + void setNorthMode( NorthMode mode ); |
| 132 | +%Docstring |
| 133 | + Sets the ``mode`` used to align the picture to a map's North. |
| 134 | +.. seealso:: northMode() |
| 135 | +.. seealso:: setNorthOffset() |
| 136 | +%End |
| 137 | + |
| 138 | + double northOffset() const; |
| 139 | +%Docstring |
| 140 | + Returns the offset added to the picture's rotation from a map's North. |
| 141 | +.. seealso:: setNorthOffset() |
| 142 | +.. seealso:: northMode() |
| 143 | + :rtype: float |
| 144 | +%End |
| 145 | + |
| 146 | + void setNorthOffset( double offset ); |
| 147 | +%Docstring |
| 148 | + Sets the ``offset`` added to the picture's rotation from a map's North. |
| 149 | +.. seealso:: northOffset() |
| 150 | +.. seealso:: setNorthMode() |
| 151 | +%End |
| 152 | + |
| 153 | + ResizeMode resizeMode() const; |
| 154 | +%Docstring |
| 155 | + Returns the resize mode used for drawing the picture within the composer |
| 156 | + item's frame. |
| 157 | +.. seealso:: setResizeMode() |
| 158 | + :rtype: ResizeMode |
| 159 | +%End |
| 160 | + |
| 161 | + void setPictureAnchor( QgsLayoutItem::ReferencePoint anchor ); |
| 162 | +%Docstring |
| 163 | + Sets the picture's ``anchor`` point, which controls how it is placed |
| 164 | + within the picture item's frame. |
| 165 | +.. seealso:: pictureAnchor() |
| 166 | +%End |
| 167 | + |
| 168 | + QgsLayoutItem::ReferencePoint pictureAnchor() const; |
| 169 | +%Docstring |
| 170 | + Returns the picture's current anchor, which controls how it is placed |
| 171 | + within the picture item's frame. |
| 172 | +.. seealso:: setPictureAnchor() |
| 173 | + :rtype: QgsLayoutItem.ReferencePoint |
| 174 | +%End |
| 175 | + |
| 176 | + QColor svgFillColor() const; |
| 177 | +%Docstring |
| 178 | + Returns the fill color used for parametrized SVG files. |
| 179 | +.. seealso:: setSvgFillColor() |
| 180 | +.. seealso:: svgStrokeColor() |
| 181 | + :rtype: QColor |
| 182 | +%End |
| 183 | + |
| 184 | + void setSvgFillColor( const QColor &color ); |
| 185 | +%Docstring |
| 186 | + Sets the fill ``color`` used for parametrized SVG files. |
| 187 | +.. note:: |
| 188 | + |
| 189 | + This setting only has an effect on parametrized SVG files, and is ignored for |
| 190 | + non-parametrized SVG files. |
| 191 | +.. seealso:: svgFillColor() |
| 192 | +.. seealso:: setSvgStrokeColor() |
| 193 | +%End |
| 194 | + |
| 195 | + QColor svgStrokeColor() const; |
| 196 | +%Docstring |
| 197 | + Returns the stroke color used for parametrized SVG files. |
| 198 | +.. seealso:: setSvgStrokeColor() |
| 199 | +.. seealso:: svgFillColor() |
| 200 | + :rtype: QColor |
| 201 | +%End |
| 202 | + |
| 203 | + void setSvgStrokeColor( const QColor &color ); |
| 204 | +%Docstring |
| 205 | + Sets the stroke ``color`` used for parametrized SVG files. |
| 206 | + \param color stroke color. |
| 207 | +.. note:: |
| 208 | + |
| 209 | + This setting only has an effect on parametrized SVG files, and is ignored for |
| 210 | + non-parametrized SVG files. |
| 211 | +.. seealso:: svgStrokelColor() |
| 212 | +.. seealso:: setSvgFillColor() |
| 213 | +%End |
| 214 | + |
| 215 | + double svgStrokeWidth() const; |
| 216 | +%Docstring |
| 217 | + Returns the stroke width (in layout units) used for parametrized SVG files. |
| 218 | +.. seealso:: setSvgStrokeWidth() |
| 219 | +.. seealso:: svgStrokeColor() |
| 220 | + :rtype: float |
| 221 | +%End |
| 222 | + |
| 223 | + void setSvgStrokeWidth( double width ); |
| 224 | +%Docstring |
| 225 | + Sets the stroke ``width`` (in layout units) used for parametrized SVG files. |
| 226 | +.. note:: |
| 227 | + |
| 228 | + This setting only has an effect on parametrized SVG files, and is ignored for |
| 229 | + non-parametrized SVG files. |
| 230 | +.. seealso:: svgStrokeWidth() |
| 231 | +.. seealso:: setSvgStrokeColor() |
| 232 | +%End |
| 233 | + |
| 234 | + Format mode() const; |
| 235 | +%Docstring |
| 236 | + Returns the current picture mode (image format). |
| 237 | + :rtype: Format |
| 238 | +%End |
| 239 | + |
| 240 | + public slots: |
| 241 | + |
| 242 | + void setPictureRotation( double rotation ); |
| 243 | +%Docstring |
| 244 | + Sets the picture ``rotation`` within the item bounds, in degrees clockwise. This does not affect |
| 245 | + the item's frame, only the way the picture is drawn within the item. |
| 246 | +.. seealso:: pictureRotation() |
| 247 | +%End |
| 248 | + |
| 249 | + void setResizeMode( ResizeMode mode ); |
| 250 | +%Docstring |
| 251 | + Sets the resize ``mode`` used for drawing the picture within the item bounds. |
| 252 | + \param mode ResizeMode to use for image file |
| 253 | +.. seealso:: resizeMode |
| 254 | +%End |
| 255 | + |
| 256 | + void refreshPicture( const QgsExpressionContext *context = 0 ); |
| 257 | +%Docstring |
| 258 | + Recalculates the source image (if using an expression for picture's source) |
| 259 | + and reloads and redraws the picture. |
| 260 | + \param context expression context for evaluating data defined picture sources |
| 261 | +%End |
| 262 | + |
| 263 | + void recalculateSize(); |
| 264 | +%Docstring |
| 265 | + Forces a recalculation of the picture's frame size |
| 266 | +%End |
| 267 | + |
| 268 | + virtual void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties ); |
| 269 | + |
| 270 | + |
| 271 | + signals: |
| 272 | + void pictureRotationChanged( double newRotation ); |
| 273 | +%Docstring |
| 274 | +Is emitted on picture rotation change |
| 275 | +%End |
| 276 | + |
| 277 | + protected: |
| 278 | + |
| 279 | + virtual void draw( QgsRenderContext &context, const QStyleOptionGraphicsItem *itemStyle = 0 ); |
| 280 | + |
| 281 | + virtual QSizeF applyItemSizeConstraint( const QSizeF &targetSize ); |
| 282 | + |
| 283 | + |
| 284 | + |
| 285 | +}; |
| 286 | + |
| 287 | +/************************************************************************ |
| 288 | + * This file has been generated automatically from * |
| 289 | + * * |
| 290 | + * src/core/layout/qgslayoutitempicture.h * |
| 291 | + * * |
| 292 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 293 | + ************************************************************************/ |
0 commit comments