1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutitem.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsLayoutItemRenderContext
{
%Docstring(signature="appended")
Contains settings and helpers relating to a render of a
:py:class:`QgsLayoutItem`.
%End
%TypeHeaderCode
#include "qgslayoutitem.h"
%End
public:
QgsLayoutItemRenderContext( QgsRenderContext &context, double viewScaleFactor = 1.0 );
%Docstring
Constructor for QgsLayoutItemRenderContext.
The ``renderContext`` parameter specifies a :py:class:`QgsRenderContext`
for use within the QgsLayoutItemRenderContext.
The ``viewScaleFactor`` gives the current view zoom (scale factor). It
can be used to scale render graphics so that they always appear a
constant size, regardless of the current view zoom.
%End
QgsRenderContext &renderContext();
%Docstring
Returns a reference to the context's render context.
Note that the context's painter has been scaled so that painter units
are pixels. Use the :py:class:`QgsRenderContext` methods to convert from
millimeters or other units to the painter's units.
%End
double viewScaleFactor() const;
%Docstring
Returns the current view zoom (scale factor). It can be used to scale
render graphics so that they always appear a constant size, regardless
of the current view zoom.
E.g. a value of 0.5 indicates that the view is zoomed out to 50% size,
so rendered items must be scaled by 200% in order to have a constant
visible size. A value of 2.0 indicates that the view is zoomed in 200%,
so rendered items must be scaled by 50% in order to have a constant
visible size.
%End
private:
QgsLayoutItemRenderContext( const QgsLayoutItemRenderContext &rh );
};
class QgsLayoutItem : QgsLayoutObject, QGraphicsRectItem, QgsLayoutUndoObjectInterface
{
%Docstring(signature="appended")
Base class for graphical items within a :py:class:`QgsLayout`.
%End
%TypeHeaderCode
#include "qgslayoutitem.h"
#include "qgslayoutitemgroup.h"
#include "qgslayoutitemmap.h"
#include "qgslayoutitempicture.h"
#include "qgslayoutitemlabel.h"
#include "qgslayoutitemlegend.h"
#include "qgslayoutitempolygon.h"
#include "qgslayoutitempolyline.h"
#include "qgslayoutitemscalebar.h"
#include "qgslayoutframe.h"
#include "qgslayoutitemshape.h"
#include "qgslayoutitempage.h"
#include "qgslayoutitemmarker.h"
#include "qgslayoutitemelevationprofile.h"
%End
%ConvertToSubClassCode
// FREAKKKKIIN IMPORTANT!!!!!!!!!!!
// IF YOU PUT SOMETHING HERE, PUT IT IN QgsLayoutObject CASTING *****ALSO******
// (it's not enough for it to be in only one of the places, as sip inconsistently
// decides which casting code to perform here)
// the conversions have to be static, because they're using multiple inheritance
// (seen in PyQt4 .sip files for some QGraphicsItem classes)
switch ( sipCpp->type() )
{
// really, these *should* use the constants from QgsLayoutItemRegistry, but sip doesn't like that!
case QGraphicsItem::UserType + 101:
sipType = sipType_QgsLayoutItemGroup;
*sipCppRet = static_cast<QgsLayoutItemGroup *>( sipCpp );
break;
case QGraphicsItem::UserType + 102:
sipType = sipType_QgsLayoutItemPage;
*sipCppRet = static_cast<QgsLayoutItemPage *>( sipCpp );
break;
case QGraphicsItem::UserType + 103:
sipType = sipType_QgsLayoutItemMap;
*sipCppRet = static_cast<QgsLayoutItemMap *>( sipCpp );
break;
case QGraphicsItem::UserType + 104:
sipType = sipType_QgsLayoutItemPicture;
*sipCppRet = static_cast<QgsLayoutItemPicture *>( sipCpp );
break;
case QGraphicsItem::UserType + 105:
sipType = sipType_QgsLayoutItemLabel;
*sipCppRet = static_cast<QgsLayoutItemLabel *>( sipCpp );
break;
case QGraphicsItem::UserType + 106:
sipType = sipType_QgsLayoutItemLegend;
*sipCppRet = static_cast<QgsLayoutItemLegend *>( sipCpp );
break;
case QGraphicsItem::UserType + 107:
sipType = sipType_QgsLayoutItemShape;
*sipCppRet = static_cast<QgsLayoutItemShape *>( sipCpp );
break;
case QGraphicsItem::UserType + 108:
sipType = sipType_QgsLayoutItemPolygon;
*sipCppRet = static_cast<QgsLayoutItemPolygon *>( sipCpp );
break;
case QGraphicsItem::UserType + 109:
sipType = sipType_QgsLayoutItemPolyline;
*sipCppRet = static_cast<QgsLayoutItemPolyline *>( sipCpp );
break;
case QGraphicsItem::UserType + 110:
sipType = sipType_QgsLayoutItemScaleBar;
*sipCppRet = static_cast<QgsLayoutItemScaleBar *>( sipCpp );
break;
case QGraphicsItem::UserType + 111:
sipType = sipType_QgsLayoutFrame;
*sipCppRet = static_cast<QgsLayoutFrame *>( sipCpp );
break;
case QGraphicsItem::UserType + 117:
sipType = sipType_QgsLayoutItemMarker;
*sipCppRet = static_cast<QgsLayoutItemMarker *>( sipCpp );
break;
case QGraphicsItem::UserType + 118:
sipType = sipType_QgsLayoutItemElevationProfile;
*sipCppRet = static_cast<QgsLayoutItemElevationProfile *>( sipCpp );
break;
// did you read that comment above? NO? Go read it now. You're about to break stuff.
default:
sipType = NULL;
}
%End
public:
enum ReferencePoint /BaseType=IntEnum/
{
UpperLeft,
UpperMiddle,
UpperRight,
MiddleLeft,
Middle,
MiddleRight,
LowerLeft,
LowerMiddle,
LowerRight,
};
enum UndoCommand /BaseType=IntEnum/
{
UndoNone,
UndoIncrementalMove,
UndoIncrementalResize,
UndoStrokeColor,
UndoStrokeWidth,
UndoBackgroundColor,
UndoOpacity,
UndoMarginLeft,
UndoMarginTop,
UndoMarginBottom,
UndoMarginRight,
UndoSetId,
UndoRotation,
UndoExportLayerName,
UndoShapeStyle,
UndoShapeCornerRadius,
UndoNodeMove,
UndoAtlasMargin,
UndoMapRotation,
UndoZoomContent,
UndoOverviewStyle,
UndoGridFramePenColor,
UndoMapGridFrameFill1Color,
UndoMapGridFrameFill2Color,
UndoMapAnnotationDistance,
UndoMapGridAnnotationFontColor,
UndoMapGridLineSymbol,
UndoMapGridMarkerSymbol,
UndoMapGridIntervalRange,
UndoMapLabelMargin,
UndoPictureRotation,
UndoPictureFillColor,
UndoPictureStrokeColor,
UndoPictureStrokeWidth,
UndoPictureNorthOffset,
UndoLabelText,
UndoLabelFont,
UndoLabelMargin,
UndoLabelFontColor,
UndoLegendText,
UndoLegendColumnCount,
UndoLegendSymbolWidth,
UndoLegendSymbolHeight,
UndoLegendMaxSymbolSize,
UndoLegendMinSymbolSize,
UndoLegendWmsLegendWidth,
UndoLegendWmsLegendHeight,
UndoLegendTitleSpaceBottom,
UndoLegendGroupSpace,
UndoLegendGroupIndent,
UndoLegendSubgroupIndent,
UndoLegendLayerSpace,
UndoLegendSymbolSpace,
UndoLegendIconSymbolSpace,
UndoLegendFontColor,
UndoLegendBoxSpace,
UndoLegendColumnSpace,
UndoLegendLineSpacing,
UndoLegendRasterStrokeWidth,
UndoLegendRasterStrokeColor,
UndoLegendTitleFont,
UndoLegendGroupFont,
UndoLegendLayerFont,
UndoLegendItemFont,
UndoScaleBarLineWidth,
UndoScaleBarSegmentSize,
UndoScaleBarSegmentsLeft,
UndoScaleBarSegments,
UndoScaleBarHeight,
UndoScaleBarSubdivisions,
UndoScaleBarSubdivisionsHeight,
UndoScaleBarFontColor,
UndoScaleBarFillColor,
UndoScaleBarFillColor2,
UndoScaleBarStrokeColor,
UndoScaleBarUnitText,
UndoScaleBarMapUnitsSegment,
UndoScaleBarLabelBarSize,
UndoScaleBarBoxContentSpace,
UndoArrowStrokeWidth,
UndoArrowHeadWidth,
UndoArrowHeadFillColor,
UndoArrowHeadStrokeColor,
UndoElevationProfileTolerance,
UndoElevationProfileChartBackground,
UndoElevationProfileChartBorder,
UndoElevationProfileDistanceMajorGridlines,
UndoElevationProfileDistanceMinorGridlines,
UndoElevationProfileDistanceFormat,
UndoElevationProfileDistanceFont,
UndoElevationProfileDistanceLabels,
UndoElevationProfileElevationMajorGridlines,
UndoElevationProfileElevationMinorGridlines,
UndoElevationProfileElevationFormat,
UndoElevationProfileElevationFont,
UndoElevationProfileElevationLabels,
UndoElevationProfileMinimumDistance,
UndoElevationProfileMaximumDistance,
UndoElevationProfileMinimumElevation,
UndoElevationProfileMaximumElevation,
UndoCustomCommand,
};
enum Flag /BaseType=IntEnum/
{
FlagOverridesPaint,
FlagProvidesClipPath,
FlagDisableSceneCaching,
};
typedef QFlags<QgsLayoutItem::Flag> Flags;
explicit QgsLayoutItem( QgsLayout *layout, bool manageZValue = true );
%Docstring
Constructor for QgsLayoutItem, with the specified parent ``layout``.
If ``manageZValue`` is ``True``, the z-Value of this item will be
managed by the layout. Generally this is the desired behavior.
%End
~QgsLayoutItem();
virtual void cleanup();
%Docstring
Called just before a batch of items are deleted, allowing them to run
cleanup tasks.
%End
virtual int type() const;
%Docstring
Returns a unique graphics item type identifier.
Plugin based subclasses should return an identifier greater than
:py:class:`QgsLayoutItemRegistry`.PluginItem.
%End
virtual QIcon icon() const;
%Docstring
Returns the item's icon.
%End
virtual QString uuid() const;
%Docstring
Returns the item identification string. This is a unique random string
set for the item upon creation.
.. note::
There is no corresponding setter for the uuid - it's created automatically.
.. seealso:: :py:func:`id`
.. seealso:: :py:func:`setId`
%End
virtual Flags itemFlags() const;
%Docstring
Returns the item's flags, which indicate how the item behaves.
.. versionadded:: 3.4.3
%End
QString id() const;
%Docstring
Returns the item's ID name. This is not necessarily unique, and
duplicate ID names may exist for a layout.
.. seealso:: :py:func:`setId`
.. seealso:: :py:func:`uuid`
%End
virtual void setId( const QString &id );
%Docstring
Set the item's ``id`` name. This is not necessarily unique, and
duplicate ID names may exist for a layout.
.. seealso:: :py:func:`id`
.. seealso:: :py:func:`uuid`
%End
virtual QString displayName() const;
%Docstring
Gets item display name. This is the item's id if set, and if not, a
user-friendly string identifying item type.
.. seealso:: :py:func:`id`
.. seealso:: :py:func:`setId`
%End
virtual void setSelected( bool selected );
%Docstring
Sets whether the item should be selected.
%End
virtual void setVisibility( bool visible );
%Docstring
Sets whether the item is ``visible``.
.. note::
QGraphicsItem.setVisible should not be called directly
on a QgsLayoutItem, as some item types (e.g., groups) need to override
the visibility toggle.
%End
void setLocked( bool locked );
%Docstring
Sets whether the item is ``locked``, preventing mouse interactions with
the item.
.. seealso:: :py:func:`isLocked`
.. seealso:: :py:func:`lockChanged`
%End
bool isLocked() const;
%Docstring
Returns ``True`` if the item is locked, and cannot be interacted with
using the mouse.
.. seealso:: :py:func:`setLocked`
.. seealso:: :py:func:`lockChanged`
%End
bool isGroupMember() const;
%Docstring
Returns ``True`` if the item is part of a :py:class:`QgsLayoutItemGroup`
group.
.. seealso:: :py:func:`parentGroup`
.. seealso:: :py:func:`setParentGroup`
%End
QgsLayoutItemGroup *parentGroup() const;
%Docstring
Returns the item's parent group, if the item is part of a
:py:class:`QgsLayoutItemGroup` group.
.. seealso:: :py:func:`isGroupMember`
.. seealso:: :py:func:`setParentGroup`
%End
void setParentGroup( QgsLayoutItemGroup *group );
%Docstring
Sets the item's parent ``group``.
.. seealso:: :py:func:`isGroupMember`
.. seealso:: :py:func:`parentGroup`
%End
enum ExportLayerBehavior /BaseType=IntEnum/
{
CanGroupWithAnyOtherItem,
CanGroupWithItemsOfSameType,
MustPlaceInOwnLayer,
ItemContainsSubLayers,
};
virtual ExportLayerBehavior exportLayerBehavior() const;
%Docstring
Returns the behavior of this item during exporting to layered exports
(e.g. SVG or geospatial PDF).
.. seealso:: :py:func:`numberExportLayers`
.. seealso:: :py:func:`exportLayerDetails`
.. versionadded:: 3.10
%End
virtual int numberExportLayers() const /Deprecated/;
%Docstring
Returns the number of layers that this item requires for exporting
during layered exports (e.g. SVG). Returns 0 if this item is to be
placed on the same layer as the previous item, 1 if it should be placed
on its own layer, and >1 if it requires multiple export layers.
Items which require multiply layers should check
:py:func:`QgsLayoutContext.currentExportLayer()` during their rendering
to determine which layer should be drawn.
.. seealso:: :py:func:`exportLayerBehavior`
.. seealso:: :py:func:`exportLayerDetails`
.. deprecated:: 3.40
Use :py:func:`~QgsLayoutItem.nextExportPart` and :py:func:`~QgsLayoutItem.exportLayerBehavior` instead.
%End
virtual void startLayeredExport();
%Docstring
Starts a multi-layer export operation.
.. seealso:: :py:func:`stopLayeredExport`
.. seealso:: :py:func:`nextExportPart`
.. versionadded:: 3.10
%End
virtual void stopLayeredExport();
%Docstring
Stops a multi-layer export operation.
.. seealso:: :py:func:`startLayeredExport`
.. seealso:: :py:func:`nextExportPart`
.. versionadded:: 3.10
%End
virtual bool nextExportPart();
%Docstring
Moves to the next export part for a multi-layered export item, during a
multi-layered export.
.. seealso:: :py:func:`startLayeredExport`
.. seealso:: :py:func:`stopLayeredExport`
.. versionadded:: 3.10
%End
struct ExportLayerDetail
{
QString name;
QString mapLayerId;
QPainter::CompositionMode compositionMode;
double opacity;
QString mapTheme;
QString groupName;
};
virtual QgsLayoutItem::ExportLayerDetail exportLayerDetails() const;
%Docstring
Returns the details for the specified current export layer.
Only valid between calls to :py:func:`~QgsLayoutItem.startLayeredExport`
and :py:func:`~QgsLayoutItem.stopLayeredExport`
.. versionadded:: 3.10
%End
virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget );
%Docstring
Handles preparing a paint surface for the layout item and painting the
item's content. Derived classes must not override this method, but
instead implement the pure virtual method QgsLayoutItem.draw.
%End
void setReferencePoint( ReferencePoint point );
%Docstring
Sets the reference ``point`` for positioning of the layout item. This
point is also fixed during resizing of the item, and any size changes
will be performed so that the position of the reference point within the
layout remains unchanged.
.. seealso:: :py:func:`referencePoint`
%End
ReferencePoint referencePoint() const;
%Docstring
Returns the reference point for positioning of the layout item. This
point is also fixed during resizing of the item, and any size changes
will be performed so that the position of the reference point within the
layout remains unchanged.
.. seealso:: :py:func:`setReferencePoint`
%End
virtual QgsLayoutSize fixedSize() const;
%Docstring
Returns the fixed size of the item, if applicable, or an empty size if
item can be freely resized.
.. seealso:: :py:func:`setFixedSize`
.. seealso:: :py:func:`minimumSize`
%End
virtual QgsLayoutSize minimumSize() const;
%Docstring
Returns the minimum allowed size of the item, if applicable, or an empty
size if item can be freely resized.
.. seealso:: :py:func:`setMinimumSize`
.. seealso:: :py:func:`fixedSize`
%End
virtual void attemptResize( const QgsLayoutSize &size, bool includesFrame = false );
%Docstring
Attempts to resize the item to a specified target ``size``. Note that
the final size of the item may not match the specified target size, as
items with a fixed or minimum size will place restrictions on the
allowed item size. Data defined item size overrides will also override
the specified target size.
If ``includesFrame`` is ``True``, then the size specified by ``size``
includes the item's frame.
.. seealso:: :py:func:`minimumSize`
.. seealso:: :py:func:`fixedSize`
.. seealso:: :py:func:`attemptMove`
.. seealso:: :py:func:`sizeWithUnits`
%End
virtual void attemptMove( const QgsLayoutPoint &point, bool useReferencePoint = true, bool includesFrame = false, int page = -1 );
%Docstring
Attempts to move the item to a specified ``point``.
If ``useReferencePoint`` is ``True``, this method will respect the
item's reference point, in that the item will be moved so that its
current reference point is placed at the specified target point.
If ``useReferencePoint`` is ``False``, the item will be moved so that
``point`` falls at the top-left corner of the item.
If ``includesFrame`` is ``True``, then the position specified by
``point`` represents the point at which to place the outside of the
item's frame.
If ``page`` is not left at the default -1 value, then the position
specified by ``point`` refers to the relative position on the
corresponding layout ``page`` (where a ``page`` of 0 represents the
first page).
Note that the final position of the item may not match the specified
target position, as data defined item position may override the
specified value.
.. seealso:: :py:func:`attemptMoveBy`
.. seealso:: :py:func:`attemptResize`
.. seealso:: :py:func:`referencePoint`
.. seealso:: :py:func:`positionWithUnits`
%End
void attemptSetSceneRect( const QRectF &rect, bool includesFrame = false );
%Docstring
Attempts to update the item's position and size to match the passed
``rect`` in layout coordinates.
If ``includesFrame`` is ``True``, then the position and size specified
by ``rect`` represents the position and size at for the outside of the
item's frame.
Note that the final position and size of the item may not match the
specified target rect, as data defined item position and size may
override the specified value.
.. seealso:: :py:func:`attemptResize`
.. seealso:: :py:func:`attemptMove`
.. seealso:: :py:func:`referencePoint`
.. seealso:: :py:func:`positionWithUnits`
%End
void attemptMoveBy( double deltaX, double deltaY );
%Docstring
Attempts to shift the item's position by a specified ``deltaX`` and
``deltaY``, in layout units.
Note that the final position of the item may not match the specified
offsets, as data defined item position and size may override the
specified value.
.. seealso:: :py:func:`attemptResize`
.. seealso:: :py:func:`attemptMove`
.. seealso:: :py:func:`referencePoint`
.. seealso:: :py:func:`positionWithUnits`
%End
QgsLayoutPoint positionWithUnits() const;
%Docstring
Returns the item's current position, including units. The position
returned is the position of the item's reference point, which may not
necessarily be the top left corner of the item.
.. seealso:: :py:func:`attemptMove`
.. seealso:: :py:func:`referencePoint`
.. seealso:: :py:func:`sizeWithUnits`
%End
int page() const;
%Docstring
Returns the page the item is currently on, with the first page returning
0.
.. seealso:: :py:func:`pagePos`
%End
QPointF pagePos() const;
%Docstring
Returns the item's position (in layout units) relative to the top left
corner of its current page.
.. seealso:: :py:func:`page`
.. seealso:: :py:func:`pagePositionWithUnits`
%End
QgsLayoutPoint pagePositionWithUnits() const;
%Docstring
Returns the item's position (in item units) relative to the top left
corner of its current page.
.. seealso:: :py:func:`page`
.. seealso:: :py:func:`pagePos`
%End
QgsLayoutSize sizeWithUnits() const;
%Docstring
Returns the item's current size, including units.
.. seealso:: :py:func:`attemptResize`
.. seealso:: :py:func:`positionWithUnits`
%End
double itemRotation() const;
%Docstring
Returns the current rotation for the item, in degrees clockwise.
Note that this method will always return the user-set rotation for the
item, which may differ from the current item rotation (if data defined
rotation settings are present). Use QGraphicsItem.rotation() to obtain
the current item rotation.
.. seealso:: :py:func:`setItemRotation`
%End
bool writeXml( QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context ) const;
%Docstring
Stores the item state in a DOM element.
:param parentElement: parent DOM element (e.g. 'Layout' element)
:param document: DOM document
:param context: read write context
.. seealso:: :py:func:`readXml`
%End
bool readXml( const QDomElement &itemElement, const QDomDocument &document, const QgsReadWriteContext &context );
%Docstring
Sets the item state from a DOM element.
:param itemElement: is the DOM node corresponding to item (e.g.
'LayoutItem' element)
:param document: DOM document
:param context: read write context
Note that item subclasses should not rely on all other items being
present in the layout at the time this method is called. Instead, any
connections and links to other items must be made in the
:py:func:`~QgsLayoutItem.finalizeRestoreFromXml` method. E.g. when
restoring a scalebar, the connection to the linked map's signals should
be implemented in :py:func:`~QgsLayoutItem.finalizeRestoreFromXml`, not
:py:func:`~QgsLayoutItem.readXml`.
.. seealso:: :py:func:`writeXml`
.. seealso:: :py:func:`finalizeRestoreFromXml`
%End
virtual void finalizeRestoreFromXml();
%Docstring
Called after all pending items have been restored from XML. Items can
use this method to run steps which must take place after all items have
been restored to the layout, such as connecting to signals emitted by
other items, which may not have existed in the layout at the time
:py:func:`~QgsLayoutItem.readXml` was called. E.g. a scalebar can use
this to connect to its linked map item after restoration from XML.
.. seealso:: :py:func:`readXml`
%End
virtual QgsAbstractLayoutUndoCommand *createCommand( const QString &text, int id, QUndoCommand *parent = 0 ) /Factory/;
bool frameEnabled() const;
%Docstring
Returns ``True`` if the item includes a frame.
.. seealso:: :py:func:`setFrameEnabled`
.. seealso:: :py:func:`frameStrokeWidth`
.. seealso:: :py:func:`frameJoinStyle`
.. seealso:: :py:func:`frameStrokeColor`
%End
virtual void setFrameEnabled( bool drawFrame );
%Docstring
Sets whether this item has a frame drawn around it or not.
.. seealso:: :py:func:`frameEnabled`
.. seealso:: :py:func:`setFrameStrokeWidth`
.. seealso:: :py:func:`setFrameJoinStyle`
.. seealso:: :py:func:`setFrameStrokeColor`
%End
void setFrameStrokeColor( const QColor &color );
%Docstring
Sets the frame stroke ``color``.
.. seealso:: :py:func:`frameStrokeColor`
.. seealso:: :py:func:`setFrameEnabled`
.. seealso:: :py:func:`setFrameJoinStyle`
.. seealso:: :py:func:`setFrameStrokeWidth`
%End
QColor frameStrokeColor() const;
%Docstring
Returns the frame's stroke color. This is only used if
:py:func:`~QgsLayoutItem.frameEnabled` returns ``True``.
.. seealso:: :py:func:`frameEnabled`
.. seealso:: :py:func:`setFrameStrokeColor`
.. seealso:: :py:func:`frameJoinStyle`
.. seealso:: :py:func:`setFrameStrokeColor`
%End
virtual void setFrameStrokeWidth( QgsLayoutMeasurement width );
%Docstring
Sets the frame stroke ``width``.
.. seealso:: :py:func:`frameStrokeWidth`
.. seealso:: :py:func:`setFrameEnabled`
.. seealso:: :py:func:`setFrameJoinStyle`
.. seealso:: :py:func:`setFrameStrokeColor`
%End
QgsLayoutMeasurement frameStrokeWidth() const;
%Docstring
Returns the frame's stroke width. This is only used if
:py:func:`~QgsLayoutItem.frameEnabled` returns ``True``.
.. seealso:: :py:func:`frameEnabled`
.. seealso:: :py:func:`setFrameStrokeWidth`
.. seealso:: :py:func:`frameJoinStyle`
.. seealso:: :py:func:`frameStrokeColor`
%End
Qt::PenJoinStyle frameJoinStyle() const;
%Docstring
Returns the join style used for drawing the item's frame.
.. seealso:: :py:func:`frameEnabled`
.. seealso:: :py:func:`setFrameJoinStyle`
.. seealso:: :py:func:`frameStrokeWidth`
.. seealso:: :py:func:`frameStrokeColor`
%End
void setFrameJoinStyle( Qt::PenJoinStyle style );
%Docstring
Sets the join ``style`` used when drawing the item's frame.
.. seealso:: :py:func:`setFrameEnabled`
.. seealso:: :py:func:`frameJoinStyle`
.. seealso:: :py:func:`setFrameStrokeWidth`
.. seealso:: :py:func:`setFrameStrokeColor`
%End
bool hasBackground() const;
%Docstring
Returns ``True`` if the item has a background.
.. seealso:: :py:func:`setBackgroundEnabled`
.. seealso:: :py:func:`backgroundColor`
%End
void setBackgroundEnabled( bool drawBackground );
%Docstring
Sets whether this item has a background drawn under it or not.
.. seealso:: :py:func:`hasBackground`
.. seealso:: :py:func:`setBackgroundColor`
%End
QColor backgroundColor( bool useDataDefined = true ) const;
%Docstring
Returns the background color for this item. This is only used if
:py:func:`~QgsLayoutItem.hasBackground` returns ``True``.
:param useDataDefined: If true, then returns the data defined override
for the background color
.. seealso:: :py:func:`setBackgroundColor`
.. seealso:: :py:func:`hasBackground`
%End
void setBackgroundColor( const QColor &color );
%Docstring
Sets the background ``color`` for this item.
.. seealso:: :py:func:`backgroundColor`
.. seealso:: :py:func:`setBackgroundEnabled`
%End
QPainter::CompositionMode blendMode() const;
%Docstring
Returns the item's composition blending mode.
.. seealso:: :py:func:`setBlendMode`
%End
void setBlendMode( QPainter::CompositionMode mode );
%Docstring
Sets the item's composition blending ``mode``.
.. seealso:: :py:func:`blendMode`
%End
double itemOpacity() const;
%Docstring
Returns the item's opacity. This method should be used instead of
QGraphicsItem.opacity() as any data defined overrides will be respected.
:return: opacity as double between 1.0 (opaque) and 0 (transparent).
.. seealso:: :py:func:`setItemOpacity`
%End
void setItemOpacity( double opacity );
%Docstring
Sets the item's ``opacity``. This method should be used instead of
QGraphicsItem.setOpacity() as any data defined overrides will be
respected.
:param opacity: double between 1.0 (opaque) and 0 (transparent).
.. seealso:: :py:func:`itemOpacity`
%End
bool excludeFromExports() const;
%Docstring
Returns whether the item should be excluded from layout exports and
prints.
.. seealso:: :py:func:`setExcludeFromExports`
%End
void setExcludeFromExports( bool exclude );
%Docstring
Sets whether the item should be excluded from layout exports and prints.
.. seealso:: :py:func:`excludeFromExports`
%End
virtual bool containsAdvancedEffects() const;
%Docstring
Returns ``True`` if the item contains contents with blend modes or
transparency effects which can only be reproduced by rastering the item.
Subclasses should ensure that implemented overrides of this method also
check the base class result.
.. seealso:: :py:func:`requiresRasterization`
%End
virtual bool requiresRasterization() const;
%Docstring
Returns ``True`` if the item is drawn in such a way that forces the
whole layout to be rasterized when exporting to vector formats.
.. seealso:: :py:func:`containsAdvancedEffects`
%End
virtual double estimatedFrameBleed() const;
%Docstring
Returns the estimated amount the item's frame bleeds outside the item's
actual rectangle. For instance, if the item has a 2mm frame stroke, then
1mm of this frame is drawn outside the item's rect. In this case the
return value will be 1.0.
Returned values are in layout units.
.. seealso:: :py:func:`rectWithFrame`
%End
virtual QRectF rectWithFrame() const;
%Docstring
Returns the item's rectangular bounds, including any bleed caused by the
item's frame. The bounds are returned in the item's coordinate system
(see Qt's QGraphicsItem docs for more details about QGraphicsItem
coordinate systems). The results differ from Qt's
:py:func:`~QgsLayoutItem.rect` function, as
:py:func:`~QgsLayoutItem.rect` makes no allowances for the portion of
outlines which are drawn outside of the item.
.. seealso:: :py:func:`estimatedFrameBleed`
%End
virtual void moveContent( double dx, double dy );
%Docstring
Moves the content of the item, by a specified ``dx`` and ``dy`` in
layout units. The default implementation has no effect.
.. seealso:: :py:func:`setMoveContentPreviewOffset`
.. seealso:: :py:func:`zoomContent`
%End
virtual void setMoveContentPreviewOffset( double dx, double dy );
%Docstring
Sets temporary offset for the item, by a specified ``dx`` and ``dy`` in
layout units. This is useful for live updates when moving item content
in a :py:class:`QgsLayoutView`. The default implementation has no
effect.
.. seealso:: :py:func:`moveContent`
%End
virtual void zoomContent( double factor, QPointF point );
%Docstring
Zooms content of item. Does nothing by default.
:param factor: zoom factor, where > 1 results in a zoom in and < 1
results in a zoom out
:param point: item point for zoom center
.. seealso:: :py:func:`moveContent`
%End
void beginCommand( const QString &commandText, UndoCommand command = UndoNone );
%Docstring
Starts new undo command for this item. The ``commandText`` should be a
capitalized, imperative tense description (e.g. "Add Map Item"). If
specified, multiple consecutive commands for this item with the same
``command`` will be collapsed into a single undo command in the layout
history.
.. seealso:: :py:func:`endCommand`
.. seealso:: :py:func:`cancelCommand`
%End
void endCommand();
%Docstring
Completes the current item command and push it onto the layout's undo
stack.
.. seealso:: :py:func:`beginCommand`
.. seealso:: :py:func:`cancelCommand`
%End
void cancelCommand();
%Docstring
Cancels the current item command and discards it.
.. seealso:: :py:func:`beginCommand`
.. seealso:: :py:func:`endCommand`
%End
bool shouldDrawItem() const;
%Docstring
Returns whether the item should be drawn in the current context.
%End
virtual QgsExpressionContext createExpressionContext() const;
virtual bool accept( QgsStyleEntityVisitorInterface *visitor ) const;
%Docstring
Accepts the specified style entity ``visitor``, causing it to visit all
style entities associated with the layout item.
Returns ``True`` if the visitor should continue visiting other objects,
or ``False`` if visiting should be canceled.
.. versionadded:: 3.10
%End
virtual QgsGeometry clipPath() const;
%Docstring
Returns the clipping path generated by this item, in layout coordinates.
.. note::
Not all items can function as clipping paths. The FlagProvidesClipPath flag
indicates if a particular item can function as a clipping path provider.
.. versionadded:: 3.16
%End
virtual bool isRefreshing() const;
%Docstring
Returns ``True`` if the item is currently refreshing content in the
background.
.. versionadded:: 3.32
%End
public slots:
virtual void refresh();
%Docstring
Refreshes the item, causing a recalculation of any property overrides
and recalculation of its position and size.
%End
virtual void invalidateCache();
%Docstring
Forces a deferred update of any cached image the item uses.
%End
virtual void redraw();
%Docstring
Triggers a redraw (update) of the item.
%End
virtual void refreshDataDefinedProperty( QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::DataDefinedProperty::AllProperties );
%Docstring
Refreshes a data defined ``property`` for the item by reevaluating the
property's value and redrawing the item with this new value. If
``property`` is set to :py:class:`QgsLayoutObject`.AllProperties then
all data defined properties for the item will be refreshed.
%End
virtual void setItemRotation( double rotation, bool adjustPosition = true );
%Docstring
Sets the layout item's ``rotation``, in degrees clockwise.
If ``adjustPosition`` is ``True``, then this rotation occurs around the
center of the item. If ``adjustPosition`` is ``False``, rotation occurs
around the item origin.
.. seealso:: :py:func:`itemRotation`
.. seealso:: :py:func:`rotateItem`
%End
virtual void rotateItem( double angle, QPointF transformOrigin );
%Docstring
Rotates the item by a specified ``angle`` in degrees clockwise around a
specified reference point.
.. seealso:: :py:func:`setItemRotation`
.. seealso:: :py:func:`itemRotation`
%End
signals:
void frameChanged();
%Docstring
Emitted if the item's frame style changes.
%End
void lockChanged();
%Docstring
Emitted if the item's lock status changes.
.. seealso:: :py:func:`isLocked`
.. seealso:: :py:func:`setLocked`
%End
void rotationChanged( double newRotation );
%Docstring
Emitted on item rotation change.
%End
void sizePositionChanged();
%Docstring
Emitted when the item's size or position changes.
%End
void backgroundTaskCountChanged( int count );
%Docstring
Emitted whenever the number of background tasks an item is executing
changes.
.. versionadded:: 3.10
%End
void clipPathChanged();
%Docstring
Emitted when the item's clipping path has changed.
.. seealso:: :py:func:`clipPath`
.. versionadded:: 3.16
%End
protected:
virtual void drawDebugRect( QPainter *painter );
%Docstring
Draws a debugging rectangle of the item's current bounds within the
specified painter.
:param painter: destination QPainter
%End
virtual void draw( QgsLayoutItemRenderContext &context ) = 0;
%Docstring
Draws the item's contents using the specified item render ``context``.
Note that the context's painter has been scaled so that painter units
are pixels. Use the :py:class:`QgsRenderContext` methods to convert from
millimeters or other units to the painter's units.
%End
virtual QPainterPath framePath() const;
%Docstring
Returns the path to use when drawing the item's frame or background.
.. seealso:: :py:func:`drawFrame`
.. seealso:: :py:func:`drawBackground`
.. versionadded:: 3.16
%End
virtual void drawFrame( QgsRenderContext &context );
%Docstring
Draws the frame around the item.
.. seealso:: :py:func:`framePath`
%End
virtual void drawBackground( QgsRenderContext &context );
%Docstring
Draws the background for the item.
.. seealso:: :py:func:`framePath`
%End
void drawRefreshingOverlay( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle );
%Docstring
Draws a "refreshing" overlay icon on the item.
.. versionadded:: 3.32
%End
virtual void setFixedSize( const QgsLayoutSize &size );
%Docstring
Sets a fixed ``size`` for the layout item, which prevents it from being
freely resized. Set an empty size if item can be freely resized.
.. seealso:: :py:func:`fixedSize`
.. seealso:: :py:func:`setMinimumSize`
%End
virtual void setMinimumSize( const QgsLayoutSize &size );
%Docstring
Sets the minimum allowed ``size`` for the layout item. Set an empty size
if item can be freely resized.
.. seealso:: :py:func:`minimumSize`
.. seealso:: :py:func:`setFixedSize`
%End
virtual QSizeF applyItemSizeConstraint( QSizeF targetSize );
%Docstring
Applies any item-specific size constraint handling to a given
``targetSize`` in layout units. Subclasses can override this method if
they need to apply advanced logic regarding item sizes, which cannot be
covered by :py:func:`~QgsLayoutItem.setFixedSize` or
:py:func:`~QgsLayoutItem.setMinimumSize`. Item size constraints are
applied after fixed, minimum and data defined size constraints.
.. seealso:: :py:func:`setFixedSize`
.. seealso:: :py:func:`setMinimumSize`
%End
void refreshItemSize();
%Docstring
Refreshes an item's size by rechecking it against any possible item
fixed or minimum sizes.
.. seealso:: :py:func:`setFixedSize`
.. seealso:: :py:func:`setMinimumSize`
.. seealso:: :py:func:`refreshItemPosition`
%End
void refreshItemPosition();
%Docstring
Refreshes an item's position by rechecking it against any possible
overrides such as data defined positioning.
.. seealso:: :py:func:`refreshItemSize`
%End
void refreshItemRotation( QPointF *origin = 0 );
%Docstring
Refreshes an item's rotation by rechecking it against any possible
overrides such as data defined rotation.
The optional ``origin`` point specifies the origin (in item coordinates)
around which the rotation should be applied.
.. seealso:: :py:func:`refreshItemSize`
.. seealso:: :py:func:`refreshItemPosition`
%End
void refreshOpacity( bool updateItem = true );
%Docstring
Refresh item's opacity, considering data defined opacity. If
``updateItem`` is set to ``False`` the item will not be automatically
updated after the opacity is set and a later call to
:py:func:`~QgsLayoutItem.update` must be made.
%End
void refreshFrame( bool updateItem = true );
%Docstring
Refresh item's frame, considering data defined colors and frame size. If
``updateItem`` is set to ``False``, the item will not be automatically
updated after the frame is set and a later call to
:py:func:`~QgsLayoutItem.update` must be made.
%End
void refreshBackgroundColor( bool updateItem = true );
%Docstring
Refresh item's background color, considering data defined colors. If
``updateItem`` is set to ``False``, the item will not be automatically
updated after the frame color is set and a later call to
:py:func:`~QgsLayoutItem.update` must be made.
%End
void refreshBlendMode();
%Docstring
Refresh item's blend mode, considering data defined blend mode.
%End
QPointF adjustPointForReferencePosition( QPointF point, QSizeF size, ReferencePoint reference ) const;
%Docstring
Adjusts the specified ``point`` at which a ``reference`` position of the
item sits and returns the top left corner of the item, if reference
point were placed at the specified position.
%End
QPointF positionAtReferencePoint( ReferencePoint reference ) const;
%Docstring
Returns the current position (in layout units) of a ``reference`` point
for the item.
%End
QgsLayoutPoint topLeftToReferencePoint( const QgsLayoutPoint &point ) const;
%Docstring
Returns the position for the reference point of the item, if the
top-left of the item was placed at the specified ``point``.
%End
virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;
%Docstring
Stores item state within an XML DOM element.
:param element: is the DOM element to store the item's properties in
:param document: DOM document
:param context: read write context
.. seealso:: :py:func:`writeXml`
.. seealso:: :py:func:`readPropertiesFromElement`
%End
virtual bool readPropertiesFromElement( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context );
%Docstring
Sets item state from a DOM element.
:param element: is the DOM element for the item
:param document: DOM document
:param context: read write context
Note that item subclasses should not rely on all other items being
present in the layout at the time this method is called. Instead, any
connections and links to other items must be made in the
:py:func:`~QgsLayoutItem.finalizeRestoreFromXml` method. E.g. when
restoring a scalebar, the connection to the linked map's signals should
be implemented in :py:func:`~QgsLayoutItem.finalizeRestoreFromXml`, not
:py:func:`~QgsLayoutItem.readPropertiesFromElement`.
.. seealso:: :py:func:`writePropertiesToElement`
.. seealso:: :py:func:`readXml`
%End
QgsLayoutSize applyDataDefinedSize( const QgsLayoutSize &size );
%Docstring
Applies any present data defined size overrides to the specified layout
``size``.
%End
};
QFlags<QgsLayoutItem::Flag> operator|(QgsLayoutItem::Flag f1, QFlags<QgsLayoutItem::Flag> f2);
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutitem.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|