1/************************************************************************ 2 * This file has been generated automatically from * 3 * * 4 * src/core/textrenderer/qgstextbackgroundsettings.h * 5 * * 6 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 7 ************************************************************************/ 8 9 10 11 12 13class QgsTextBackgroundSettings 14{ 15%Docstring(signature="appended") 16Container for settings relating to a text background object. 17 18.. note:: 19 20 :py:class:`QgsTextBackgroundSettings` objects are implicitly shared. 21 22.. versionadded:: 3.0 23%End 24 25%TypeHeaderCode 26#include "qgstextbackgroundsettings.h" 27%End 28 public: 29 30 enum ShapeType 31 { 32 ShapeRectangle, 33 ShapeSquare, 34 ShapeEllipse, 35 ShapeCircle, 36 ShapeSVG, 37 ShapeMarkerSymbol, 38 }; 39 40 enum SizeType 41 { 42 SizeBuffer, 43 SizeFixed, 44 SizePercent 45 }; 46 47 enum RotationType 48 { 49 RotationSync, 50 RotationOffset, 51 RotationFixed 52 }; 53 54 QgsTextBackgroundSettings(); 55 56 QgsTextBackgroundSettings( const QgsTextBackgroundSettings &other ); 57%Docstring 58Copy constructor. 59 60:param other: source QgsTextBackgroundSettings 61%End 62 63 64 ~QgsTextBackgroundSettings(); 65 66 bool operator==( const QgsTextBackgroundSettings &other ) const; 67 bool operator!=( const QgsTextBackgroundSettings &other ) const; 68 69 bool enabled() const; 70%Docstring 71Returns whether the background is enabled. 72 73.. seealso:: :py:func:`setEnabled` 74%End 75 76 void setEnabled( bool enabled ); 77%Docstring 78Sets whether the text background will be drawn. 79 80:param enabled: set to ``True`` to draw background 81 82.. seealso:: :py:func:`enabled` 83%End 84 85 ShapeType type() const; 86%Docstring 87Returns the type of background shape (e.g., square, ellipse, SVG). 88 89.. seealso:: :py:func:`setType` 90%End 91 92 void setType( ShapeType type ); 93%Docstring 94Sets the type of background shape to draw (e.g., square, ellipse, SVG). 95 96:param type: shape type 97 98.. seealso:: :py:func:`type` 99%End 100 101 QString svgFile() const; 102%Docstring 103Returns the absolute path to the background SVG file, if set. 104 105.. seealso:: :py:func:`setSvgFile` 106%End 107 108 void setSvgFile( const QString &file ); 109%Docstring 110Sets the path to the background SVG file. This is only used if :py:func:`~QgsTextBackgroundSettings.type` is set to 111QgsTextBackgroundSettings.ShapeSVG. The path must be absolute. 112 113:param file: Absolute SVG file path 114 115.. seealso:: :py:func:`svgFile` 116%End 117 118 QgsMarkerSymbol *markerSymbol() const; 119%Docstring 120Returns the marker symbol to be rendered in the background. Ownership remains with 121the background settings. 122 123.. note:: 124 125 This is only used when the :py:func:`~QgsTextBackgroundSettings.type` is QgsTextBackgroundSettings.ShapeMarkerSymbol. 126 127.. seealso:: :py:func:`setMarkerSymbol` 128 129.. versionadded:: 3.10 130%End 131 132 void setMarkerSymbol( QgsMarkerSymbol *symbol /Transfer/ ); 133%Docstring 134Sets the current marker ``symbol`` for the background shape. Ownership is transferred 135to the background settings. 136 137.. note:: 138 139 This is only used when the :py:func:`~QgsTextBackgroundSettings.type` is QgsTextBackgroundSettings.ShapeMarkerSymbol. 140 141.. seealso:: :py:func:`markerSymbol` 142 143.. versionadded:: 3.10 144%End 145 146 QgsFillSymbol *fillSymbol() const; 147%Docstring 148Returns the fill symbol to be rendered in the background. Ownership remains with 149the background settings. 150 151.. note:: 152 153 This is only used when the :py:func:`~QgsTextBackgroundSettings.type` is QgsTextBackgroundSettings.ShapeRectangle, 154 QgsTextBackgroundSettings.ShapeSquare, QgsTextBackgroundSettings.ShapeCircle or 155 QgsTextBackgroundSettings.ShapeEllipse 156 157.. seealso:: :py:func:`setFillSymbol` 158 159.. versionadded:: 3.20 160%End 161 162 void setFillSymbol( QgsFillSymbol *symbol /Transfer/ ); 163%Docstring 164Sets the current fill ``symbol`` for the background shape. Ownership is transferred 165to the background settings. 166 167.. note:: 168 169 This is only used when the :py:func:`~QgsTextBackgroundSettings.type` is QgsTextBackgroundSettings.ShapeRectangle, 170 QgsTextBackgroundSettings.ShapeSquare, QgsTextBackgroundSettings.ShapeCircle or 171 QgsTextBackgroundSettings.ShapeEllipse 172 173.. seealso:: :py:func:`fillSymbol` 174 175.. versionadded:: 3.20 176%End 177 178 SizeType sizeType() const; 179%Docstring 180Returns the method used to determine the size of the background shape (e.g., fixed size or buffer 181around text). 182 183.. seealso:: :py:func:`setSizeType` 184 185.. seealso:: :py:func:`size` 186%End 187 188 void setSizeType( SizeType type ); 189%Docstring 190Sets the method used to determine the size of the background shape (e.g., fixed size or buffer 191around text). 192 193:param type: size method 194 195.. seealso:: :py:func:`sizeType` 196 197.. seealso:: :py:func:`setSize` 198%End 199 200 QSizeF size() const; 201%Docstring 202Returns the size of the background shape. The meaning of the size depends on the current :py:func:`~QgsTextBackgroundSettings.sizeType`, 203e.g., for size types of QgsTextBackgroundSettings.SizeFixed the size will represent the actual width and 204height of the shape, for QgsTextBackgroundSettings.SizeBuffer the size will represent the horizontal 205and vertical margins to add to the text when calculating the size of the shape. 206 207.. seealso:: :py:func:`setSize` 208 209.. seealso:: :py:func:`sizeType` 210%End 211 212 void setSize( QSizeF size ); 213%Docstring 214Sets the size of the background shape. The meaning of the size depends on the current :py:func:`~QgsTextBackgroundSettings.sizeType`, 215e.g., for size types of QgsTextBackgroundSettings.SizeFixed the size will represent the actual width and 216height of the shape, for QgsTextBackgroundSettings.SizeBuffer the size will represent the horizontal 217and vertical margins to add to the text when calculating the size of the shape. 218 219:param size: QSizeF representing horizontal and vertical size components for shape 220 221.. seealso:: :py:func:`size` 222 223.. seealso:: :py:func:`setSizeType` 224%End 225 226 QgsUnitTypes::RenderUnit sizeUnit() const; 227%Docstring 228Returns the units used for the shape's size. This value has no meaning if the :py:func:`~QgsTextBackgroundSettings.sizeType` is set to 229QgsTextBackgroundSettings.SizePercent. 230 231.. seealso:: :py:func:`setSizeUnit` 232 233.. seealso:: :py:func:`sizeType` 234 235.. seealso:: :py:func:`size` 236%End 237 238 void setSizeUnit( QgsUnitTypes::RenderUnit unit ); 239%Docstring 240Sets the units used for the shape's size. This value has no meaning if the :py:func:`~QgsTextBackgroundSettings.sizeType` is set to 241QgsTextBackgroundSettings.SizePercent. 242 243:param unit: size units 244 245.. seealso:: :py:func:`sizeUnit` 246 247.. seealso:: :py:func:`setSizeType` 248 249.. seealso:: :py:func:`setSize` 250%End 251 252 QgsMapUnitScale sizeMapUnitScale() const; 253%Docstring 254Returns the map unit scale object for the shape size. This is only used if the 255:py:func:`~QgsTextBackgroundSettings.sizeUnit` is set to :py:class:`QgsUnitTypes`.RenderMapUnit. 256 257.. seealso:: :py:func:`setSizeMapUnitScale` 258 259.. seealso:: :py:func:`sizeUnit` 260%End 261 262 void setSizeMapUnitScale( const QgsMapUnitScale &scale ); 263%Docstring 264Sets the map unit scale object for the shape size. This is only used if the 265:py:func:`~QgsTextBackgroundSettings.sizeUnit` is set to :py:class:`QgsUnitTypes`.RenderMapUnit. 266 267:param scale: scale for shape size 268 269.. seealso:: :py:func:`sizeMapUnitScale` 270 271.. seealso:: :py:func:`setSizeUnit` 272%End 273 274 RotationType rotationType() const; 275%Docstring 276Returns the method used for rotating the background shape. 277 278.. seealso:: :py:func:`setRotationType` 279 280.. seealso:: :py:func:`rotation` 281%End 282 283 void setRotationType( RotationType type ); 284%Docstring 285Sets the method used for rotating the background shape. 286 287:param type: rotation method 288 289.. seealso:: :py:func:`rotationType` 290 291.. seealso:: :py:func:`setRotation` 292%End 293 294 double rotation() const; 295%Docstring 296Returns the rotation for the background shape, in degrees clockwise. 297 298.. seealso:: :py:func:`rotationType` 299 300.. seealso:: :py:func:`setRotation` 301%End 302 303 void setRotation( double rotation ); 304%Docstring 305Sets the ``rotation`` for the background shape, in degrees clockwise. 306 307.. seealso:: :py:func:`rotation` 308 309.. seealso:: :py:func:`setRotationType` 310%End 311 312 QPointF offset() const; 313%Docstring 314Returns the offset used for drawing the background shape. Units are determined 315via :py:func:`~QgsTextBackgroundSettings.offsetUnit`. 316 317.. seealso:: :py:func:`setOffset` 318 319.. seealso:: :py:func:`offsetUnit` 320%End 321 322 void setOffset( QPointF offset ); 323%Docstring 324Sets the offset used for drawing the background shape. Units are specified using 325:py:func:`~QgsTextBackgroundSettings.setOffsetUnit`. 326 327:param offset: offset for shape 328 329.. seealso:: :py:func:`offset` 330 331.. seealso:: :py:func:`setOffsetUnit` 332%End 333 334 QgsUnitTypes::RenderUnit offsetUnit() const; 335%Docstring 336Returns the units used for the shape's offset. 337 338.. seealso:: :py:func:`setOffsetUnit` 339 340.. seealso:: :py:func:`offset` 341%End 342 343 void setOffsetUnit( QgsUnitTypes::RenderUnit units ); 344%Docstring 345Sets the units used for the shape's offset. 346 347:param units: offset units 348 349.. seealso:: :py:func:`offsetUnit` 350 351.. seealso:: :py:func:`setOffset` 352%End 353 354 QgsMapUnitScale offsetMapUnitScale() const; 355%Docstring 356Returns the map unit scale object for the shape offset. This is only used if the 357:py:func:`~QgsTextBackgroundSettings.offsetUnit` is set to :py:class:`QgsUnitTypes`.RenderMapUnit. 358 359.. seealso:: :py:func:`setOffsetMapUnitScale` 360 361.. seealso:: :py:func:`offsetUnit` 362%End 363 364 void setOffsetMapUnitScale( const QgsMapUnitScale &scale ); 365%Docstring 366Sets the map unit scale object for the shape offset. This is only used if the 367:py:func:`~QgsTextBackgroundSettings.offsetUnit` is set to :py:class:`QgsUnitTypes`.RenderMapUnit. 368 369:param scale: scale for shape offset 370 371.. seealso:: :py:func:`offsetMapUnitScale` 372 373.. seealso:: :py:func:`setOffsetUnit` 374%End 375 376 QSizeF radii() const; 377%Docstring 378Returns the radii used for rounding the corners of shapes. Units are retrieved 379through :py:func:`~QgsTextBackgroundSettings.radiiUnit`. 380 381.. seealso:: :py:func:`setRadii` 382 383.. seealso:: :py:func:`radiiUnit` 384%End 385 386 void setRadii( QSizeF radii ); 387%Docstring 388Sets the radii used for rounding the corners of shapes. This is only used if 389:py:func:`~QgsTextBackgroundSettings.type` is set to QgsTextBackgroundSettings.ShapeRectangle or QgsTextBackgroundSettings.ShapeSquare. 390 391:param radii: QSizeF representing horizontal and vertical radii for rounded corners. Units are 392 specified through :py:func:`~QgsTextBackgroundSettings.setRadiiUnit` 393 394.. seealso:: :py:func:`radii` 395 396.. seealso:: :py:func:`setRadiiUnit` 397%End 398 399 QgsUnitTypes::RenderUnit radiiUnit() const; 400%Docstring 401Returns the units used for the shape's radii. 402 403.. seealso:: :py:func:`setRadiiUnit` 404 405.. seealso:: :py:func:`radii` 406%End 407 408 void setRadiiUnit( QgsUnitTypes::RenderUnit units ); 409%Docstring 410Sets the units used for the shape's radii. 411 412:param units: radii units 413 414.. seealso:: :py:func:`radiiUnit` 415 416.. seealso:: :py:func:`setRadii` 417%End 418 419 QgsMapUnitScale radiiMapUnitScale() const; 420%Docstring 421Returns the map unit scale object for the shape radii. This is only used if the 422:py:func:`~QgsTextBackgroundSettings.radiiUnit` is set to :py:class:`QgsUnitTypes`.RenderMapUnit. 423 424.. seealso:: :py:func:`setRadiiMapUnitScale` 425 426.. seealso:: :py:func:`radiiUnit` 427%End 428 429 void setRadiiMapUnitScale( const QgsMapUnitScale &scale ); 430%Docstring 431Sets the map unit scale object for the shape radii. This is only used if the 432:py:func:`~QgsTextBackgroundSettings.radiiUnit` is set to :py:class:`QgsUnitTypes`.RenderMapUnit. 433 434:param scale: scale for shape radii 435 436.. seealso:: :py:func:`radiiMapUnitScale` 437 438.. seealso:: :py:func:`setRadiiUnit` 439%End 440 441 double opacity() const; 442%Docstring 443Returns the background shape's opacity. The opacity is a double value between 0 (fully transparent) and 1 (totally 444opaque). 445 446.. seealso:: :py:func:`setOpacity` 447%End 448 449 void setOpacity( double opacity ); 450%Docstring 451Sets the background shape's opacity. 452 453:param opacity: opacity as a double value between 0 (fully transparent) and 1 (totally 454 opaque) 455 456.. seealso:: :py:func:`opacity` 457%End 458 459 QPainter::CompositionMode blendMode() const; 460%Docstring 461Returns the blending mode used for drawing the background shape. 462 463.. seealso:: :py:func:`setBlendMode` 464%End 465 466 void setBlendMode( QPainter::CompositionMode mode ); 467%Docstring 468Sets the blending mode used for drawing the background shape. 469 470:param mode: blending mode 471 472.. seealso:: :py:func:`blendMode` 473%End 474 475 QColor fillColor() const; 476%Docstring 477Returns the color used for filing the background shape. 478 479.. seealso:: :py:func:`setFillColor` 480 481.. seealso:: :py:func:`strokeColor` 482 483.. note:: 484 485 As of QGIS 3.20, using this function is only recommended for SVG backgrounds, while 486 other background types should be configured through their symbols. 487%End 488 489 void setFillColor( const QColor &color ); 490%Docstring 491Sets the color used for filing the background shape. 492 493:param color: background color 494 495.. seealso:: :py:func:`fillColor` 496 497.. seealso:: :py:func:`setStrokeColor` 498 499.. note:: 500 501 As of QGIS 3.20, using this function is only recommended for SVG backgrounds, while 502 other background types should be configured through their symbols. 503%End 504 505 QColor strokeColor() const; 506%Docstring 507Returns the color used for outlining the background shape. 508 509.. seealso:: :py:func:`setStrokeColor` 510 511.. seealso:: :py:func:`fillColor` 512 513.. note:: 514 515 As of QGIS 3.20, using this function is only recommended for SVG backgrounds, while 516 other background types should be configured through their symbols. 517%End 518 519 void setStrokeColor( const QColor &color ); 520%Docstring 521Sets the color used for outlining the background shape. 522 523:param color: stroke color 524 525.. seealso:: :py:func:`strokeColor` 526 527.. seealso:: :py:func:`setFillColor` 528%End 529 530 double strokeWidth() const; 531%Docstring 532Returns the width of the shape's stroke (stroke). Units are retrieved through 533:py:func:`~QgsTextBackgroundSettings.strokeWidthUnit`. 534 535.. seealso:: :py:func:`setStrokeWidth` 536 537.. seealso:: :py:func:`strokeWidthUnit` 538%End 539 540 void setStrokeWidth( double width ); 541%Docstring 542Sets the width of the shape's stroke (stroke). Units are specified through 543:py:func:`~QgsTextBackgroundSettings.setStrokeWidthUnit`. 544 545.. seealso:: :py:func:`strokeWidth` 546 547.. seealso:: :py:func:`setStrokeWidthUnit` 548 549.. note:: 550 551 As of QGIS 3.20, using this function is only recommended for SVG backgrounds, while 552 other background types should be configured through their symbols. 553%End 554 555 QgsUnitTypes::RenderUnit strokeWidthUnit() const; 556%Docstring 557Returns the units used for the shape's stroke width. 558 559.. seealso:: :py:func:`setStrokeWidthUnit` 560 561.. seealso:: :py:func:`strokeWidth` 562%End 563 564 void setStrokeWidthUnit( QgsUnitTypes::RenderUnit units ); 565%Docstring 566Sets the units used for the shape's stroke width. 567 568:param units: stroke width units 569 570.. seealso:: :py:func:`strokeWidthUnit` 571 572.. seealso:: :py:func:`setStrokeWidth` 573 574.. note:: 575 576 As of QGIS 3.20, using this function is only recommended for SVG backgrounds, while 577 other background types should be configured through their symbols. 578%End 579 580 QgsMapUnitScale strokeWidthMapUnitScale() const; 581%Docstring 582Returns the map unit scale object for the shape stroke width. This is only used if the 583:py:func:`~QgsTextBackgroundSettings.strokeWidthUnit` is set to :py:class:`QgsUnitTypes`.RenderMapUnit. 584 585.. seealso:: :py:func:`setStrokeWidthMapUnitScale` 586 587.. seealso:: :py:func:`strokeWidthUnit` 588%End 589 590 void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ); 591%Docstring 592Sets the map unit scale object for the shape stroke width. This is only used if the 593:py:func:`~QgsTextBackgroundSettings.strokeWidthUnit` is set to :py:class:`QgsUnitTypes`.RenderMapUnit. 594 595:param scale: scale for shape stroke width 596 597.. seealso:: :py:func:`strokeWidthMapUnitScale` 598 599.. seealso:: :py:func:`setStrokeWidthUnit` 600 601.. note:: 602 603 As of QGIS 3.20, using this function is only recommended for SVG backgrounds, while 604 other background types should be configured through their symbols. 605%End 606 607 Qt::PenJoinStyle joinStyle() const; 608%Docstring 609Returns the join style used for drawing the background shape. 610 611.. seealso:: :py:func:`setJoinStyle` 612%End 613 614 void setJoinStyle( Qt::PenJoinStyle style ); 615%Docstring 616Sets the join style used for drawing the background shape. 617 618:param style: join style 619 620.. seealso:: :py:func:`joinStyle` 621 622.. note:: 623 624 As of QGIS 3.20, using this function is only recommended for SVG backgrounds, while 625 other background types should be configured through their symbols. 626%End 627 628 const QgsPaintEffect *paintEffect() const; 629%Docstring 630Returns the current paint effect for the background shape. 631 632:return: paint effect 633 634.. seealso:: :py:func:`setPaintEffect` 635%End 636 637 void setPaintEffect( QgsPaintEffect *effect /Transfer/ ); 638%Docstring 639Sets the current paint ``effect`` for the background shape. 640 641:param effect: paint effect. Ownership is transferred to the background settings. 642 643.. seealso:: :py:func:`paintEffect` 644%End 645 646 void readFromLayer( QgsVectorLayer *layer ); 647%Docstring 648Reads settings from a layer's custom properties (for QGIS 2.x projects). 649 650:param layer: source vector layer 651%End 652 653 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ); 654%Docstring 655Read settings from a DOM element. 656 657.. seealso:: :py:func:`writeXml` 658%End 659 660 QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const; 661%Docstring 662Write settings into a DOM element. 663 664.. seealso:: :py:func:`readXml` 665%End 666 667 void updateDataDefinedProperties( QgsRenderContext &context, const QgsPropertyCollection &properties ); 668%Docstring 669Updates the format by evaluating current values of data defined properties. 670 671.. note:: 672 673 Since QGIS 3.20, data defined fill color, stroke color, stroke width, and 674 pen join style will only modify SVG backgrounds. For other background types, the 675 data defined properties within symbols are to be used. 676 677.. versionadded:: 3.10 678%End 679 680 681 QSet<QString> referencedFields( const QgsRenderContext &context ) const; 682%Docstring 683Returns all field names referenced by the configuration (e.g. from data defined properties). 684 685.. versionadded:: 3.14 686%End 687 688}; 689 690/************************************************************************ 691 * This file has been generated automatically from * 692 * * 693 * src/core/textrenderer/qgstextbackgroundsettings.h * 694 * * 695 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 696 ************************************************************************/ 697