QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
Public Types | Static Public Member Functions | List of all members
QgsCompositionConverter Class Reference

QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout. More...

#include <qgscompositionconverter.h>

Public Types

enum  DataDefinedProperty {
  NoProperty = 0, AllProperties, TestProperty, PresetPaperSize,
  PaperWidth, PaperHeight, NumPages, PaperOrientation,
  PageNumber, PositionX, PositionY, ItemWidth,
  ItemHeight, ItemRotation, Transparency, Opacity,
  BlendMode, ExcludeFromExports, FrameColor, BackgroundColor,
  MapRotation, MapScale, MapXMin, MapYMin,
  MapXMax, MapYMax, MapAtlasMargin, MapLayers,
  MapStylePreset, PictureSource, PictureSvgBackgroundColor, PictureSvgStrokeColor,
  PictureSvgStrokeWidth, SourceUrl, LegendTitle, LegendColumnCount,
  ScalebarFillColor, ScalebarFillColor2, ScalebarLineColor, ScalebarLineWidth
}
 Composition data defined properties for different item types. More...
 
enum  MarkerMode { DefaultMarker, NoMarker, SVGMarker }
 The MarkerMode enum is the old QGIS 2.x arrow marker mode. More...
 

Static Public Member Functions

static QList< QgsLayoutObject * > addItemsFromCompositionXml (QgsPrintLayout *layout, const QDomElement &parentElement, QPointF *position=nullptr, bool pasteInPlace=false)
 addItemsFromCompositionXml parse a QGIS 2.x composition XML in the parentElement, converts the 2.x items to the new layout elements and add them to the layout More...
 
static QDomDocument convertCompositionTemplate (const QDomDocument &document, QgsProject *project)
 Convert a composition template document to a layout template. More...
 
static std::unique_ptr< QgsPrintLayoutcreateLayoutFromCompositionXml (const QDomElement &composerElement, QgsProject *project)
 createLayoutFromCompositionXml is a factory that creates layout instances from a QGIS 2.x XML composition parentElement and a QGIS project More...
 
static bool isCompositionTemplate (const QDomDocument &document)
 Check if the given document is a composition template. More...
 

Detailed Description

QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout.

Note
Not available in Python bindings.
Since
QGIS 3.0

Definition at line 54 of file qgscompositionconverter.h.

Member Enumeration Documentation

◆ DataDefinedProperty

Composition data defined properties for different item types.

Enumerator
NoProperty 

No property.

AllProperties 

All properties for item.

TestProperty 

Dummy property with no effect on item.

PresetPaperSize 

Preset paper size for composition.

PaperWidth 

Paper width.

PaperHeight 

Paper height.

NumPages 

Number of pages in composition.

PaperOrientation 

Paper orientation.

PageNumber 

Page number for item placement.

PositionX 

X position on page.

PositionY 

Y position on page.

ItemWidth 

Width of item.

ItemHeight 

Height of item.

ItemRotation 

Rotation of item.

Transparency 

Item transparency (deprecated)

Opacity 

Item opacity.

BlendMode 

Item blend mode.

ExcludeFromExports 

Exclude item from exports.

FrameColor 

Item frame color.

BackgroundColor 

Item background color.

MapRotation 

Map rotation.

MapScale 

Map scale.

MapXMin 

Map extent x minimum.

MapYMin 

Map extent y minimum.

MapXMax 

Map extent x maximum.

MapYMax 

Map extent y maximum.

MapAtlasMargin 

Map atlas margin.

MapLayers 

Map layer set.

MapStylePreset 

Layer and style map theme.

PictureSource 

Picture source url.

PictureSvgBackgroundColor 

SVG background color.

PictureSvgStrokeColor 

SVG stroke color.

PictureSvgStrokeWidth 

SVG stroke width.

SourceUrl 

Html source url.

LegendTitle 

Legend title.

LegendColumnCount 

Legend column count.

ScalebarFillColor 

Scalebar fill color.

ScalebarFillColor2 

Scalebar secondary fill color.

ScalebarLineColor 

Scalebar line color.

ScalebarLineWidth 

Scalebar line width.

Definition at line 61 of file qgscompositionconverter.h.

◆ MarkerMode

The MarkerMode enum is the old QGIS 2.x arrow marker mode.

Enumerator
DefaultMarker 
NoMarker 
SVGMarker 

Definition at line 115 of file qgscompositionconverter.h.

Member Function Documentation

◆ addItemsFromCompositionXml()

QList< QgsLayoutObject * > QgsCompositionConverter::addItemsFromCompositionXml ( QgsPrintLayout layout,
const QDomElement &  parentElement,
QPointF *  position = nullptr,
bool  pasteInPlace = false 
)
static

addItemsFromCompositionXml parse a QGIS 2.x composition XML in the parentElement, converts the 2.x items to the new layout elements and add them to the layout

Parameters
layoutwhere the items will be added
parentElementparent DOM element
positionfor pasting
pasteInPlaceif true element position is translated to position
Returns
list of layout object items that have been added to the layout

Definition at line 309 of file qgscompositionconverter.cpp.

◆ convertCompositionTemplate()

QDomDocument QgsCompositionConverter::convertCompositionTemplate ( const QDomDocument &  document,
QgsProject project 
)
static

Convert a composition template document to a layout template.

Parameters
documentcontaining a composition
project
Returns
dom document with the converted template
Since
QGIS 3.0.1

Definition at line 468 of file qgscompositionconverter.cpp.

◆ createLayoutFromCompositionXml()

std::unique_ptr< QgsPrintLayout > QgsCompositionConverter::createLayoutFromCompositionXml ( const QDomElement &  composerElement,
QgsProject project 
)
static

createLayoutFromCompositionXml is a factory that creates layout instances from a QGIS 2.x XML composition parentElement and a QGIS project

Returns
a QgsPrintLayout instance

Definition at line 122 of file qgscompositionconverter.cpp.

◆ isCompositionTemplate()

bool QgsCompositionConverter::isCompositionTemplate ( const QDomDocument &  document)
static

Check if the given document is a composition template.

Returns
true if the document is a composition template
Since
QGIS 3.0.1

Definition at line 463 of file qgscompositionconverter.cpp.


The documentation for this class was generated from the following files: