65 void QgsCompositionConverter::initPropertyDefinitions()
 
   67   if ( !sPropertyDefinitions.isEmpty() )
 
   75           "|<b>B5</b>|<b>B4</b>|<b>B3</b>|<b>B2</b>|<b>B1</b>|<b>B0</b>" 
   76           "|<b>Legal</b>|<b>Ansi A</b>|<b>Ansi B</b>|<b>Ansi C</b>|<b>Ansi D</b>|<b>Ansi E</b>" 
   77           "|<b>Arch A</b>|<b>Arch B</b>|<b>Arch C</b>|<b>Arch D</b>|<b>Arch E</b>|<b>Arch E1</b>]" 
  121   QgsCompositionConverter::initPropertyDefinitions();
 
  122   return sPropertyDefinitions;
 
  128   initPropertyDefinitions();
 
  130   QDomElement parentElement = composerElement.parentNode().toElement();
 
  132   std::unique_ptr< QgsPrintLayout > layout = std::make_unique< QgsPrintLayout >( project );
 
  133   layout->undoStack()->blockCommands( 
true );
 
  135   layout->mCustomProperties.readXml( composerElement );
 
  138   layout->guides().setVisible( composerElement.attribute( QStringLiteral( 
"guidesVisible" ), QStringLiteral( 
"1" ) ).toInt() != 0 );
 
  140   int printResolution = composerElement.attribute( QStringLiteral( 
"printResolution" ), QStringLiteral( 
"300" ) ).toInt();
 
  141   layout->renderContext().setDpi( printResolution );
 
  144   int pages = composerElement.attribute( QStringLiteral( 
"numPages" ) ).toInt( );
 
  145   float paperHeight = composerElement.attribute( QStringLiteral( 
"paperHeight" ) ).toDouble( );
 
  146   float paperWidth = composerElement.attribute( QStringLiteral( 
"paperWidth" ) ).toDouble( );
 
  148   QString name = composerElement.attribute( QStringLiteral( 
"name" ) );
 
  150   if ( name.isEmpty() )
 
  151     name = composerElement.attribute( QStringLiteral( 
"title" ) );
 
  153   if ( name.isEmpty() )
 
  154     name = parentElement.attribute( QStringLiteral( 
"title" ) );
 
  155   layout->setName( name );
 
  157   for ( 
int j = 0; j < pages; j++ )
 
  161     layout->pageCollection()->addPage( page );
 
  163     QDomNodeList snapLineNodes = composerElement.elementsByTagName( QStringLiteral( 
"SnapLine" ) );
 
  164     for ( 
int i = 0; i < snapLineNodes.size(); ++i )
 
  166       QDomElement snapLineElem = snapLineNodes.at( i ).toElement();
 
  167       double x1 = snapLineElem.attribute( QStringLiteral( 
"x1" ) ).toDouble();
 
  168       double y1 = snapLineElem.attribute( QStringLiteral( 
"y1" ) ).toDouble();
 
  169       double x2 = snapLineElem.attribute( QStringLiteral( 
"x2" ) ).toDouble();
 
  171       Qt::Orientation orientation( x1 == x2 ? Qt::Orientation::Vertical : Qt::Orientation::Horizontal );
 
  173       std::unique_ptr< QgsLayoutGuide > guide = std::make_unique< QgsLayoutGuide >( orientation, position, page );
 
  174       layout->guides().addGuide( guide.release() );
 
  179   if ( composerElement.elementsByTagName( QStringLiteral( 
"symbol" ) ).size() )
 
  181     QDomElement symbolElement = composerElement.elementsByTagName( QStringLiteral( 
"symbol" ) ).at( 0 ).toElement();
 
  185     std::unique_ptr< QgsFillSymbol > symbol( QgsSymbolLayerUtils::loadSymbol<QgsFillSymbol>( symbolElement, context ) );
 
  187       layout->pageCollection()->setPageStyleSymbol( symbol.get() );
 
  193   if ( parentElement.elementsByTagName( QStringLiteral( 
"Atlas" ) ).size() )
 
  195     QDomElement atlasElement = parentElement.elementsByTagName( QStringLiteral( 
"Atlas" ) ).at( 0 ).toElement();
 
  196     readAtlasXml( layout->atlas(), atlasElement, layout->project() );
 
  199   layout->undoStack()->blockCommands( 
false );
 
  204 void QgsCompositionConverter::adjustPos( 
QgsPrintLayout *layout, 
QgsLayoutItem *layoutItem, QPointF *position, 
bool &pasteInPlace, 
int zOrderOffset, QPointF &pasteShiftPos, 
int &pageNumber )
 
  214       layoutItem->
attemptMoveBy( pasteShiftPos.x(), pasteShiftPos.y() );
 
  218   if ( !layoutItem->scene() )
 
  220   layoutItem->setZValue( layoutItem->zValue() + zOrderOffset );
 
  223 void QgsCompositionConverter::restoreGeneralComposeItemProperties( 
QgsLayoutItem *layoutItem, 
const QDomElement &itemElem )
 
  226   QDomNodeList composerItemList = itemElem.elementsByTagName( QStringLiteral( 
"ComposerItem" ) );
 
  227   if ( !composerItemList.isEmpty() )
 
  229     QDomElement composerItemElem = composerItemList.at( 0 ).toElement();
 
  232     if ( !
qgsDoubleNear( composerItemElem.attribute( QStringLiteral( 
"rotation" ), QStringLiteral( 
"0" ) ).toDouble(), 0.0 ) )
 
  235       layoutItem->
setItemRotation( composerItemElem.attribute( QStringLiteral( 
"rotation" ), QStringLiteral( 
"0" ) ).toDouble(), 
false );
 
  237     QgsCompositionConverter::readXml( layoutItem, composerItemElem );
 
  241 QRectF QgsCompositionConverter::itemPosition( 
QgsLayoutItem *layoutItem, 
const QDomElement &itemElem )
 
  244   double x, y, pagex, pagey, width, height;
 
  245   bool xOk, yOk, pageOk, pagexOk, pageyOk, widthOk, heightOk, positionModeOk;
 
  247   x = itemElem.attribute( QStringLiteral( 
"x" ) ).toDouble( &xOk );
 
  248   y = itemElem.attribute( QStringLiteral( 
"y" ) ).toDouble( &yOk );
 
  249   page = itemElem.attribute( QStringLiteral( 
"page" ) ).toInt( &pageOk );
 
  250   pagex = itemElem.attribute( QStringLiteral( 
"pagex" ) ).toDouble( &pagexOk );
 
  251   pagey = itemElem.attribute( QStringLiteral( 
"pagey" ) ).toDouble( &pageyOk );
 
  252   width = itemElem.attribute( QStringLiteral( 
"width" ) ).toDouble( &widthOk );
 
  253   height = itemElem.attribute( QStringLiteral( 
"height" ) ).toDouble( &heightOk );
 
  256   layoutItem->mReferencePoint = 
static_cast< QgsLayoutItem::ReferencePoint >( itemElem.attribute( QStringLiteral( 
"positionMode" ) ).toInt( &positionModeOk ) );
 
  257   if ( !positionModeOk )
 
  262   if ( pageOk && pagexOk && pageyOk )
 
  281   return QRectF( x, y, width, height );
 
  284 QPointF QgsCompositionConverter::minPointFromXml( 
const QDomElement &elem )
 
  286   double minX = std::numeric_limits<double>::max();
 
  287   double minY = std::numeric_limits<double>::max();
 
  288   QDomNodeList composerItemList = elem.elementsByTagName( QStringLiteral( 
"ComposerItem" ) );
 
  289   for ( 
int i = 0; i < composerItemList.size(); ++i )
 
  291     QDomElement currentComposerItemElem = composerItemList.at( i ).toElement();
 
  294     x = currentComposerItemElem.attribute( QStringLiteral( 
"x" ) ).toDouble( &xOk );
 
  295     y = currentComposerItemElem.attribute( QStringLiteral( 
"y" ) ).toDouble( &yOk );
 
  300     minX = std::min( minX, x );
 
  301     minY = std::min( minY, y );
 
  303   if ( minX < std::numeric_limits<double>::max() )
 
  305     return QPointF( minX, minY );
 
  309     return QPointF( 0, 0 );
 
  316   initPropertyDefinitions();
 
  318   QList< QgsLayoutObject * > newItems;
 
  323   int zOrderOffset = layout->mItemsModel->zOrderListSize();
 
  325   QPointF pasteShiftPos;
 
  332     QPointF minItemPos = minPointFromXml( parentElement );
 
  335     pasteShiftPos = *position - minItemPos;
 
  338       pageNumber = layout->mPageCollection->pageNumberForPoint( *position );
 
  345   for ( 
int i = 0; i < parentElement.elementsByTagName( QStringLiteral( 
"ComposerMap" ) ).size(); i++ )
 
  347     QDomNode itemNode( parentElement.elementsByTagName( QStringLiteral( 
"ComposerMap" ) ).at( i ) );
 
  349     readMapXml( layoutItem, itemNode.toElement(), layout->
project(), mapIdUiidMap );
 
  350     adjustPos( layout, layoutItem, position, pasteInPlace, zOrderOffset, pasteShiftPos, pageNumber );
 
  351     newItems << layoutItem ;
 
  355   for ( 
int i = 0; i < parentElement.elementsByTagName( QStringLiteral( 
"ComposerLabel" ) ).size(); i++ )
 
  357     QDomNode itemNode( parentElement.elementsByTagName( QStringLiteral( 
"ComposerLabel" ) ).at( i ) );
 
  359     readLabelXml( layoutItem, itemNode.toElement(), layout->
project() );
 
  360     adjustPos( layout, layoutItem, position, pasteInPlace, zOrderOffset, pasteShiftPos, pageNumber );
 
  361     newItems << layoutItem ;
 
  365   for ( 
int i = 0; i < parentElement.elementsByTagName( QStringLiteral( 
"ComposerShape" ) ).size(); i++ )
 
  367     QDomNode itemNode( parentElement.elementsByTagName( QStringLiteral( 
"ComposerShape" ) ).at( i ) );
 
  369     readShapeXml( layoutItem, itemNode.toElement(), layout->
project() );
 
  370     adjustPos( layout, layoutItem, position, pasteInPlace, zOrderOffset, pasteShiftPos, pageNumber );
 
  371     newItems << layoutItem ;
 
  375   for ( 
int i = 0; i < parentElement.elementsByTagName( QStringLiteral( 
"ComposerPicture" ) ).size(); i++ )
 
  377     QDomNode itemNode( parentElement.elementsByTagName( QStringLiteral( 
"ComposerPicture" ) ).at( i ) );
 
  379     readPictureXml( layoutItem, itemNode.toElement(), layout->
project(), mapIdUiidMap );
 
  380     adjustPos( layout, layoutItem, position, pasteInPlace, zOrderOffset, pasteShiftPos, pageNumber );
 
  381     newItems << layoutItem ;
 
  385   for ( 
int i = 0; i < parentElement.elementsByTagName( QStringLiteral( 
"ComposerPolygon" ) ).size(); i++ )
 
  387     QDomNode itemNode( parentElement.elementsByTagName( QStringLiteral( 
"ComposerPolygon" ) ).at( i ) );
 
  389     readPolyXml<QgsLayoutItemPolygon, QgsFillSymbol>( layoutItem, itemNode.toElement(), layout->
project() );
 
  390     adjustPos( layout, layoutItem, position, pasteInPlace, zOrderOffset, pasteShiftPos, pageNumber );
 
  391     newItems << layoutItem ;
 
  395   for ( 
int i = 0; i < parentElement.elementsByTagName( QStringLiteral( 
"ComposerPolyline" ) ).size(); i++ )
 
  397     QDomNode itemNode( parentElement.elementsByTagName( QStringLiteral( 
"ComposerPolyline" ) ).at( i ) );
 
  399     readPolyXml<QgsLayoutItemPolyline, QgsLineSymbol>( layoutItem, itemNode.toElement(), layout->
project() );
 
  400     adjustPos( layout, layoutItem, position, pasteInPlace, zOrderOffset, pasteShiftPos, pageNumber );
 
  401     newItems << layoutItem ;
 
  405   for ( 
int i = 0; i < parentElement.elementsByTagName( QStringLiteral( 
"ComposerArrow" ) ).size(); i++ )
 
  407     QDomNode itemNode( parentElement.elementsByTagName( QStringLiteral( 
"ComposerArrow" ) ).at( i ) );
 
  409     readArrowXml( layoutItem, itemNode.toElement(), layout->
project() );
 
  410     adjustPos( layout, layoutItem, position, pasteInPlace, zOrderOffset, pasteShiftPos, pageNumber );
 
  411     newItems << layoutItem ;
 
  415   for ( 
int i = 0; i < parentElement.elementsByTagName( QStringLiteral( 
"ComposerScaleBar" ) ).size(); i++ )
 
  417     QDomNode itemNode( parentElement.elementsByTagName( QStringLiteral( 
"ComposerScaleBar" ) ).at( i ) );
 
  419     readScaleBarXml( layoutItem, itemNode.toElement(), layout->
project(), mapIdUiidMap );
 
  420     adjustPos( layout, layoutItem, position, pasteInPlace, zOrderOffset, pasteShiftPos, pageNumber );
 
  421     newItems << layoutItem ;
 
  425   for ( 
int i = 0; i < parentElement.elementsByTagName( QStringLiteral( 
"ComposerLegend" ) ).size(); i++ )
 
  427     QDomNode itemNode( parentElement.elementsByTagName( QStringLiteral( 
"ComposerLegend" ) ).at( i ) );
 
  429     readLegendXml( layoutItem, itemNode.toElement(), layout->
project(), mapIdUiidMap );
 
  430     adjustPos( layout, layoutItem, position, pasteInPlace, zOrderOffset, pasteShiftPos, pageNumber );
 
  431     newItems << layoutItem ;
 
  435   for ( 
int i = 0; i < parentElement.elementsByTagName( QStringLiteral( 
"ComposerHtml" ) ).size(); i++ )
 
  437     QDomNode itemNode( parentElement.elementsByTagName( QStringLiteral( 
"ComposerHtml" ) ).at( i ) );
 
  439     readHtmlXml( layoutItem, itemNode.toElement(), layout->
project() );
 
  441     const QList<QgsLayoutFrame *> framesList( layoutItem->
frames() );
 
  442     for ( 
const auto &frame : framesList )
 
  444       adjustPos( layout, frame, position, pasteInPlace, zOrderOffset, pasteShiftPos, pageNumber );
 
  446     newItems << layoutItem ;
 
  450   for ( 
int i = 0; i < parentElement.elementsByTagName( QStringLiteral( 
"ComposerAttributeTableV2" ) ).size(); i++ )
 
  452     QDomNode itemNode( parentElement.elementsByTagName( QStringLiteral( 
"ComposerAttributeTableV2" ) ).at( i ) );
 
  454     readTableXml( layoutItem, itemNode.toElement(), layout->
project() );
 
  456     const QList<QgsLayoutFrame *> framesList( layoutItem->
frames() );
 
  457     for ( 
const auto &frame : framesList )
 
  459       adjustPos( layout, frame, position, pasteInPlace, zOrderOffset, pasteShiftPos, pageNumber );
 
  461     newItems << layoutItem ;
 
  465   for ( 
int i = 0; i < parentElement.elementsByTagName( QStringLiteral( 
"ComposerItemGroup" ) ).size(); i++ )
 
  467     QDomNode itemNode( parentElement.elementsByTagName( QStringLiteral( 
"ComposerItemGroup" ) ).at( i ) );
 
  469     readGroupXml( layoutItem, itemNode.toElement(), layout->
project(), newItems );
 
  470     adjustPos( layout, layoutItem, position, pasteInPlace, zOrderOffset, pasteShiftPos, pageNumber );
 
  471     newItems << layoutItem ;
 
  479   return document.elementsByTagName( QStringLiteral( 
"Composition" ) ).count() > 0;
 
  488   if ( document.elementsByTagName( QStringLiteral( 
"Composition" ) ).count( ) > 0 )
 
  490     QDomElement composerElem = document.elementsByTagName( QStringLiteral( 
"Composition" ) ).at( 0 ).toElement( );
 
  494     QDomElement elem = layout->writeXml( doc, context );
 
  495     doc.appendChild( elem );
 
  503   if ( itemElem.isNull() )
 
  508   restoreGeneralComposeItemProperties( layoutItem, itemElem );
 
  511   layoutItem->
setText( itemElem.attribute( QStringLiteral( 
"labelText" ) ) );
 
  514   layoutItem->
setMode( itemElem.attribute( QStringLiteral( 
"htmlState" ) ).toInt() == Qt::Checked ? QgsLayoutItemLabel::Mode::ModeHtml : QgsLayoutItemLabel::Mode::ModeFont );
 
  517   bool marginXOk = 
false;
 
  518   bool marginYOk = 
false;
 
  519   double marginX = itemElem.attribute( QStringLiteral( 
"marginX" ) ).toDouble( &marginXOk );
 
  520   double marginY = itemElem.attribute( QStringLiteral( 
"marginY" ) ).toDouble( &marginYOk );
 
  521   if ( !marginXOk || !marginYOk )
 
  524     double margin = itemElem.attribute( QStringLiteral( 
"margin" ), QStringLiteral( 
"1.0" ) ).toDouble();
 
  532   layoutItem->
setHAlign( 
static_cast< Qt::AlignmentFlag 
>( itemElem.attribute( QStringLiteral( 
"halign" ) ).toInt() ) );
 
  535   layoutItem->
setVAlign( 
static_cast< Qt::AlignmentFlag 
>( itemElem.attribute( QStringLiteral( 
"valign" ) ).toInt() ) );
 
  544   QDomNodeList fontColorList = itemElem.elementsByTagName( QStringLiteral( 
"FontColor" ) );
 
  545   if ( !fontColorList.isEmpty() )
 
  547     QDomElement fontColorElem = fontColorList.at( 0 ).toElement();
 
  548     int red = fontColorElem.attribute( QStringLiteral( 
"red" ), QStringLiteral( 
"0" ) ).toInt();
 
  549     int green = fontColorElem.attribute( QStringLiteral( 
"green" ), QStringLiteral( 
"0" ) ).toInt();
 
  550     int blue = fontColorElem.attribute( QStringLiteral( 
"blue" ), QStringLiteral( 
"0" ) ).toInt();
 
  567   restoreGeneralComposeItemProperties( layoutItem, itemElem );
 
  573   if ( itemElem.elementsByTagName( QStringLiteral( 
"symbol" ) ).size() )
 
  575     QDomElement symbolElement = itemElem.elementsByTagName( QStringLiteral( 
"symbol" ) ).at( 0 ).toElement();
 
  576     std::unique_ptr< QgsFillSymbol > shapeStyleSymbol( QgsSymbolLayerUtils::loadSymbol<QgsFillSymbol>( symbolElement, context ) );
 
  577     if ( shapeStyleSymbol )
 
  578       layoutItem->
setSymbol( shapeStyleSymbol.get() );
 
  583     QVariantMap properties;
 
  587       properties.insert( QStringLiteral( 
"style" ), QStringLiteral( 
"solid" ) );
 
  591       properties.insert( QStringLiteral( 
"style" ), QStringLiteral( 
"no" ) );
 
  595       properties.insert( QStringLiteral( 
"style_border" ), QStringLiteral( 
"solid" ) );
 
  599       properties.insert( QStringLiteral( 
"style_border" ), QStringLiteral( 
"no" ) );
 
  602     properties.insert( QStringLiteral( 
"width_border" ), QString::number( layoutItem->pen().widthF() ) );
 
  605     QDomNodeList outlineColorList = itemElem.elementsByTagName( QStringLiteral( 
"OutlineColor" ) );
 
  606     if ( !outlineColorList.isEmpty() )
 
  608       QDomElement frameColorElem = outlineColorList.at( 0 ).toElement();
 
  609       bool redOk, greenOk, blueOk, alphaOk, widthOk;
 
  610       int penRed, penGreen, penBlue, penAlpha;
 
  613       penWidth = itemElem.attribute( QStringLiteral( 
"outlineWidth" ) ).toDouble( &widthOk );
 
  614       penRed = frameColorElem.attribute( QStringLiteral( 
"red" ) ).toInt( &redOk );
 
  615       penGreen = frameColorElem.attribute( QStringLiteral( 
"green" ) ).toInt( &greenOk );
 
  616       penBlue = frameColorElem.attribute( QStringLiteral( 
"blue" ) ).toInt( &blueOk );
 
  617       penAlpha = frameColorElem.attribute( QStringLiteral( 
"alpha" ) ).toInt( &alphaOk );
 
  619       if ( redOk && greenOk && blueOk && alphaOk && widthOk )
 
  622         properties.insert( QStringLiteral( 
"width_border" ), QString::number( penWidth ) );
 
  625     QDomNodeList fillColorList = itemElem.elementsByTagName( QStringLiteral( 
"FillColor" ) );
 
  626     if ( !fillColorList.isEmpty() )
 
  628       QDomElement fillColorElem = fillColorList.at( 0 ).toElement();
 
  629       bool redOk, greenOk, blueOk, alphaOk;
 
  630       int fillRed, fillGreen, fillBlue, fillAlpha;
 
  632       fillRed = fillColorElem.attribute( QStringLiteral( 
"red" ) ).toInt( &redOk );
 
  633       fillGreen = fillColorElem.attribute( QStringLiteral( 
"green" ) ).toInt( &greenOk );
 
  634       fillBlue = fillColorElem.attribute( QStringLiteral( 
"blue" ) ).toInt( &blueOk );
 
  635       fillAlpha = fillColorElem.attribute( QStringLiteral( 
"alpha" ) ).toInt( &alphaOk );
 
  637       if ( redOk && greenOk && blueOk && alphaOk )
 
  640         properties.insert( QStringLiteral( 
"style" ), QStringLiteral( 
"solid" ) );
 
  643     if ( itemElem.hasAttribute( QStringLiteral( 
"transparentFill" ) ) )
 
  646       bool hasOldTransparentFill = itemElem.attribute( QStringLiteral( 
"transparentFill" ), QStringLiteral( 
"0" ) ).toInt();
 
  647       if ( hasOldTransparentFill )
 
  649         properties.insert( QStringLiteral( 
"style" ), QStringLiteral( 
"no" ) );
 
  654     layoutItem->
setSymbol( shapeStyleSymbol.get() );
 
  665   restoreGeneralComposeItemProperties( layoutItem, itemElem );
 
  669   bool positionModeOk = 
false;
 
  670   layoutItem->mReferencePoint = 
static_cast< QgsLayoutItem::ReferencePoint >( itemElem.attribute( QStringLiteral( 
"positionMode" ) ).toInt( &positionModeOk ) );
 
  671   if ( !positionModeOk )
 
  673     layoutItem->mReferencePoint = QgsLayoutItem::ReferencePoint::UpperLeft;
 
  675   bool anchorPointOk = 
false;
 
  678   if ( !anchorPointOk )
 
  680     layoutItem->mPictureAnchor = QgsLayoutItem::ReferencePoint::UpperLeft;
 
  684   layoutItem->mSvgStrokeWidth = itemElem.attribute( QStringLiteral( 
"svgBorderWidth" ), QStringLiteral( 
"0.2" ) ).toDouble();
 
  686   QString imagePath = itemElem.attribute( QStringLiteral( 
"file" ) );
 
  691     if ( imagePath.endsWith( QLatin1String( 
".svg" ), Qt::CaseInsensitive ) )
 
  694       imagePath = pathResolver.
readPath( imagePath );
 
  697   layoutItem->mPictureHeight = itemElem.attribute( QStringLiteral( 
"pictureHeight" ), QStringLiteral( 
"10" ) ).toDouble();
 
  698   layoutItem->mPictureWidth = itemElem.attribute( QStringLiteral( 
"pictureWidth" ), QStringLiteral( 
"10" ) ).toDouble();
 
  701   if ( !
qgsDoubleNear( itemElem.attribute( QStringLiteral( 
"pictureRotation" ), QStringLiteral( 
"0" ) ).toDouble(), 0.0 ) )
 
  703     layoutItem->mPictureRotation = itemElem.attribute( QStringLiteral( 
"pictureRotation" ), QStringLiteral( 
"0" ) ).toDouble();
 
  708   layoutItem->mNorthArrowHandler->
setNorthOffset( itemElem.attribute( QStringLiteral( 
"northOffset" ), QStringLiteral( 
"0" ) ).toDouble() );
 
  710   QString rotationMapId = itemElem.attribute( QStringLiteral( 
"mapId" ), QStringLiteral( 
"-1" ) );
 
  711   if ( rotationMapId != QLatin1String( 
"-1" ) )
 
  725   readPolyXml<QgsLayoutItemPolyline, QgsLineSymbol>( layoutItem, itemElem, project );
 
  727   QDomNodeList startPointList = itemElem.elementsByTagName( QStringLiteral( 
"StartPoint" ) );
 
  728   if ( ! startPointList.isEmpty() )
 
  730     QDomElement node = startPointList.at( 0 ).toElement();
 
  731     polygon.append( QPointF( node.attribute( QStringLiteral( 
"x" ) ).toDouble( ), node.attribute( QStringLiteral( 
"y" ) ).toDouble() ) );
 
  733   QDomNodeList stopPointList = itemElem.elementsByTagName( QStringLiteral( 
"StopPoint" ) );
 
  734   if ( ! stopPointList.isEmpty() )
 
  736     QDomElement node = stopPointList.at( 0 ).toElement();
 
  737     polygon.append( QPointF( node.attribute( QStringLiteral( 
"x" ) ).toDouble( ), node.attribute( QStringLiteral( 
"y" ) ).toDouble() ) );
 
  742   if ( markerMode == QgsCompositionConverter::MarkerMode::DefaultMarker )
 
  744     layoutItem->
setEndMarker( QgsLayoutItemPolyline::MarkerMode::ArrowHead );
 
  745     layoutItem->
setStartMarker( QgsLayoutItemPolyline::MarkerMode::NoMarker );
 
  748     layoutItem->
setArrowHeadStrokeWidth( itemElem.attribute( QStringLiteral( 
"outlineWidth" ), QStringLiteral( 
"1.0" ) ).toDouble( ) );
 
  749     layoutItem->
setArrowHeadWidth( itemElem.attribute( QStringLiteral( 
"arrowHeadWidth" ), QStringLiteral( 
"1.0" ) ).toDouble( ) );
 
  751   else if ( markerMode == QgsCompositionConverter::MarkerMode::SVGMarker )
 
  753     QString endMarkerFile = itemElem.attribute( QStringLiteral( 
"endMarkerFile" ) );
 
  754     QString startMarkerFile = itemElem.attribute( QStringLiteral( 
"endMarkerFile" ) );
 
  761       if ( !endMarkerFile.isEmpty() )
 
  763         if ( endMarkerFile.endsWith( QLatin1String( 
".svg" ), Qt::CaseInsensitive ) )
 
  766           endMarkerFile = pathResolver.
readPath( endMarkerFile );
 
  768       if ( !startMarkerFile.isEmpty() )
 
  770         if ( startMarkerFile.endsWith( QLatin1String( 
".svg" ), Qt::CaseInsensitive ) )
 
  773           startMarkerFile = pathResolver.
readPath( startMarkerFile );
 
  776     if ( !endMarkerFile.isEmpty() )
 
  778       layoutItem->
setEndMarker( QgsLayoutItemPolyline::MarkerMode::SvgMarker );
 
  781     if ( !startMarkerFile.isEmpty() )
 
  783       layoutItem->
setStartMarker( QgsLayoutItemPolyline::MarkerMode::SvgMarker );
 
  789     layoutItem->
setEndMarker( QgsLayoutItemPolyline::MarkerMode::NoMarker );
 
  790     layoutItem->
setStartMarker( QgsLayoutItemPolyline::MarkerMode::NoMarker );
 
  793   double margin = polygon.boundingRect().left() - layoutItem->pos().x();
 
  794   polygon.translate( - polygon.boundingRect().left() + margin, - polygon.boundingRect().top() + margin );
 
  802   restoreGeneralComposeItemProperties( layoutItem, itemElem );
 
  804   mapId2Uuid[ itemElem.attribute( QStringLiteral( 
"id" ) ) ] = layoutItem->
uuid();
 
  815   QDomNodeList extentNodeList = itemElem.elementsByTagName( QStringLiteral( 
"Extent" ) );
 
  816   if ( !extentNodeList.isEmpty() )
 
  818     QDomElement extentElem = extentNodeList.at( 0 ).toElement();
 
  819     double xmin, xmax, ymin, ymax;
 
  820     xmin = extentElem.attribute( QStringLiteral( 
"xmin" ) ).toDouble();
 
  821     xmax = extentElem.attribute( QStringLiteral( 
"xmax" ) ).toDouble();
 
  822     ymin = extentElem.attribute( QStringLiteral( 
"ymin" ) ).toDouble();
 
  823     ymax = extentElem.attribute( QStringLiteral( 
"ymax" ) ).toDouble();
 
  827   QDomNodeList crsNodeList = itemElem.elementsByTagName( QStringLiteral( 
"crs" ) );
 
  828   if ( !crsNodeList.isEmpty() )
 
  830     QDomElement crsElem = crsNodeList.at( 0 ).toElement();
 
  839   if ( !
qgsDoubleNear( itemElem.attribute( QStringLiteral( 
"mapRotation" ), QStringLiteral( 
"0" ) ).toDouble(), 0.0 ) )
 
  841     layoutItem->
setMapRotation( itemElem.attribute( QStringLiteral( 
"mapRotation" ), QStringLiteral( 
"0" ) ).toDouble() );
 
  845   layoutItem->
setFollowVisibilityPreset( itemElem.attribute( QStringLiteral( 
"followPreset" ) ).compare( QLatin1String( 
"true" ) ) == 0 );
 
  849   QString keepLayerSetFlag = itemElem.attribute( QStringLiteral( 
"keepLayerSet" ) );
 
  850   if ( keepLayerSetFlag.compare( QLatin1String( 
"true" ), Qt::CaseInsensitive ) == 0 )
 
  859   QString drawCanvasItemsFlag = itemElem.attribute( QStringLiteral( 
"drawCanvasItems" ), QStringLiteral( 
"true" ) );
 
  860   if ( drawCanvasItemsFlag.compare( QLatin1String( 
"true" ), Qt::CaseInsensitive ) == 0 )
 
  869   layoutItem->mLayerStyleOverrides.clear();
 
  872   layoutItem->mLayers.clear();
 
  874   QDomNodeList layerSetNodeList = itemElem.elementsByTagName( QStringLiteral( 
"LayerSet" ) );
 
  875   if ( !layerSetNodeList.isEmpty() )
 
  877     QDomElement layerSetElem = layerSetNodeList.at( 0 ).toElement();
 
  878     QDomNodeList layerIdNodeList = layerSetElem.elementsByTagName( QStringLiteral( 
"Layer" ) );
 
  879     layoutItem->mLayers.reserve( layerIdNodeList.size() );
 
  880     for ( 
int i = 0; i < layerIdNodeList.size(); ++i )
 
  882       QDomElement layerElem = layerIdNodeList.at( i ).toElement();
 
  883       QString layerId = layerElem.text();
 
  884       QString layerName = layerElem.attribute( QStringLiteral( 
"name" ) );
 
  885       QString layerSource = layerElem.attribute( QStringLiteral( 
"source" ) );
 
  886       QString layerProvider = layerElem.attribute( QStringLiteral( 
"provider" ) );
 
  888       QgsMapLayerRef ref( layerId, layerName, layerSource, layerProvider );
 
  889       ref.resolveWeakly( project );
 
  890       layoutItem->mLayers << ref;
 
  895   QDomNodeList layerStylesNodeList = itemElem.elementsByTagName( QStringLiteral( 
"LayerStyles" ) );
 
  896   layoutItem->mKeepLayerStyles = !layerStylesNodeList.isEmpty();
 
  897   if ( layoutItem->mKeepLayerStyles )
 
  899     QDomElement layerStylesElem = layerStylesNodeList.at( 0 ).toElement();
 
  900     QDomNodeList layerStyleNodeList = layerStylesElem.elementsByTagName( QStringLiteral( 
"LayerStyle" ) );
 
  901     for ( 
int i = 0; i < layerStyleNodeList.size(); ++i )
 
  903       const QDomElement &layerStyleElement = layerStyleNodeList.at( i ).toElement();
 
  904       QString layerId = layerStyleElement.attribute( QStringLiteral( 
"layerid" ) );
 
  905       QString layerName = layerStyleElement.attribute( QStringLiteral( 
"name" ) );
 
  906       QString layerSource = layerStyleElement.attribute( QStringLiteral( 
"source" ) );
 
  907       QString layerProvider = layerStyleElement.attribute( QStringLiteral( 
"provider" ) );
 
  908       QgsMapLayerRef ref( layerId, layerName, layerSource, layerProvider );
 
  909       ref.resolveWeakly( project );
 
  912       style.
readXml( layerStyleElement );
 
  913       layoutItem->mLayerStyleOverrides.insert( ref.layerId, style.
xmlData() );
 
  917   layoutItem->mDrawing = 
false;
 
  918   layoutItem->mNumCachedLayers = 0;
 
  919   layoutItem->mCacheInvalidated = 
true;
 
  923   QDomNodeList mapOverviewNodeList = itemElem.elementsByTagName( QStringLiteral( 
"ComposerMapOverview" ) );
 
  924   for ( 
int i = 0; i < mapOverviewNodeList.size(); ++i )
 
  926     QDomElement mapOverviewElem = mapOverviewNodeList.at( i ).toElement();
 
  927     std::unique_ptr<QgsLayoutItemMapOverview> mapOverview( 
new QgsLayoutItemMapOverview( mapOverviewElem.attribute( QStringLiteral( 
"name" ) ), layoutItem ) );
 
  928     mapOverview->readXml( mapOverviewElem, doc, context );
 
  929     QString frameMapId = mapOverviewElem.attribute( QStringLiteral( 
"frameMap" ), QStringLiteral( 
"-1" ) );
 
  930     if ( frameMapId != QLatin1String( 
"-1" ) && mapId2Uuid.contains( frameMapId ) )
 
  935         mapOverview->setLinkedMap( mapInstance );
 
  937       layoutItem->mOverviewStack->addOverview( mapOverview.release() );
 
  942   layoutItem->mGridStack->readXml( itemElem, doc, context );
 
  947   QDomNodeList gridNodeList = itemElem.elementsByTagName( QStringLiteral( 
"Grid" ) );
 
  948   if ( layoutItem->mGridStack->size() == 0 && !gridNodeList.isEmpty() )
 
  950     QDomElement gridElem = gridNodeList.at( 0 ).toElement();
 
  952     mapGrid->
setEnabled( gridElem.attribute( QStringLiteral( 
"show" ), QStringLiteral( 
"0" ) ) != QLatin1String( 
"0" ) );
 
  954     mapGrid->
setIntervalX( gridElem.attribute( QStringLiteral( 
"intervalX" ), QStringLiteral( 
"0" ) ).toDouble() );
 
  955     mapGrid->
setIntervalY( gridElem.attribute( QStringLiteral( 
"intervalY" ), QStringLiteral( 
"0" ) ).toDouble() );
 
  956     mapGrid->
setOffsetX( gridElem.attribute( QStringLiteral( 
"offsetX" ), QStringLiteral( 
"0" ) ).toDouble() );
 
  957     mapGrid->
setOffsetY( gridElem.attribute( QStringLiteral( 
"offsetY" ), QStringLiteral( 
"0" ) ).toDouble() );
 
  958     mapGrid->
setCrossLength( gridElem.attribute( QStringLiteral( 
"crossLength" ), QStringLiteral( 
"3" ) ).toDouble() );
 
  960     mapGrid->
setFrameWidth( gridElem.attribute( QStringLiteral( 
"gridFrameWidth" ), QStringLiteral( 
"2.0" ) ).toDouble() );
 
  961     mapGrid->
setFramePenSize( gridElem.attribute( QStringLiteral( 
"gridFramePenThickness" ), QStringLiteral( 
"0.5" ) ).toDouble() );
 
  966     QDomElement gridSymbolElem = gridElem.firstChildElement( QStringLiteral( 
"symbol" ) );
 
  968     if ( gridSymbolElem.isNull() )
 
  972       lineSymbol->
setWidth( gridElem.attribute( QStringLiteral( 
"penWidth" ), QStringLiteral( 
"0" ) ).toDouble() );
 
  973       lineSymbol->
setColor( QColor( gridElem.attribute( QStringLiteral( 
"penColorRed" ), QStringLiteral( 
"0" ) ).toInt(),
 
  974                                     gridElem.attribute( QStringLiteral( 
"penColorGreen" ), QStringLiteral( 
"0" ) ).toInt(),
 
  975                                     gridElem.attribute( QStringLiteral( 
"penColorBlue" ), QStringLiteral( 
"0" ) ).toInt() ) );
 
  979       lineSymbol = QgsSymbolLayerUtils::loadSymbol<QgsLineSymbol>( gridSymbolElem, context );
 
  984     QDomNodeList annotationNodeList = gridElem.elementsByTagName( QStringLiteral( 
"Annotation" ) );
 
  985     if ( !annotationNodeList.isEmpty() )
 
  987       QDomElement annotationElem = annotationNodeList.at( 0 ).toElement();
 
  988       mapGrid->
setAnnotationEnabled( annotationElem.attribute( QStringLiteral( 
"show" ), QStringLiteral( 
"0" ) ) != QLatin1String( 
"0" ) );
 
  998       mapGrid->
setAnnotationFrameDistance( annotationElem.attribute( QStringLiteral( 
"frameDistance" ), QStringLiteral( 
"0" ) ).toDouble() );
 
  999       QFont annotationFont;
 
 1000       annotationFont.fromString( annotationElem.attribute( QStringLiteral( 
"font" ), QString() ) );
 
 1003       annotationFormat.
setFont( annotationFont );
 
 1004       if ( annotationFont.pointSizeF() > 0 )
 
 1006         annotationFormat.
setSize( annotationFont.pointSizeF() );
 
 1009       else if ( annotationFont.pixelSize() > 0 )
 
 1011         annotationFormat.
setSize( annotationFont.pixelSize() );
 
 1017       mapGrid->
setAnnotationPrecision( annotationElem.attribute( QStringLiteral( 
"precision" ), QStringLiteral( 
"3" ) ).toInt() );
 
 1019     layoutItem->mGridStack->addGrid( mapGrid );
 
 1023   QDomNodeList atlasNodeList = itemElem.elementsByTagName( QStringLiteral( 
"AtlasMap" ) );
 
 1024   if ( !atlasNodeList.isEmpty() )
 
 1026     QDomElement atlasElem = atlasNodeList.at( 0 ).toElement();
 
 1027     layoutItem->mAtlasDriven = ( atlasElem.attribute( QStringLiteral( 
"atlasDriven" ), QStringLiteral( 
"0" ) ) != QLatin1String( 
"0" ) );
 
 1028     if ( atlasElem.hasAttribute( QStringLiteral( 
"fixedScale" ) ) ) 
 
 1030       layoutItem->
setAtlasScalingMode( atlasElem.attribute( QStringLiteral( 
"fixedScale" ), QStringLiteral( 
"0" ) ) != QLatin1String( 
"0" )  ? QgsLayoutItemMap::AtlasScalingMode::Fixed : QgsLayoutItemMap::AtlasScalingMode::Auto );
 
 1032     else if ( atlasElem.hasAttribute( QStringLiteral( 
"scalingMode" ) ) )
 
 1036     layoutItem->
setAtlasMargin( atlasElem.attribute( QStringLiteral( 
"margin" ), QStringLiteral( 
"0.1" ) ).toDouble() );
 
 1047   restoreGeneralComposeItemProperties( layoutItem, itemElem );
 
 1049   layoutItem->
setHeight( itemElem.attribute( QStringLiteral( 
"height" ), QStringLiteral( 
"5.0" ) ).toDouble() );
 
 1050   layoutItem->
setHeight( itemElem.attribute( QStringLiteral( 
"height" ), QStringLiteral( 
"5.0" ) ).toDouble() );
 
 1051   layoutItem->
setLabelBarSpace( itemElem.attribute( QStringLiteral( 
"labelBarSpace" ), QStringLiteral( 
"3.0" ) ).toDouble() );
 
 1052   layoutItem->
setBoxContentSpace( itemElem.attribute( QStringLiteral( 
"boxContentSpace" ), QStringLiteral( 
"1.0" ) ).toDouble() );
 
 1053   layoutItem->
setNumberOfSegments( itemElem.attribute( QStringLiteral( 
"numSegments" ), QStringLiteral( 
"2" ) ).toInt() );
 
 1054   layoutItem->
setNumberOfSegmentsLeft( itemElem.attribute( QStringLiteral( 
"numSegmentsLeft" ), QStringLiteral( 
"0" ) ).toInt() );
 
 1055   layoutItem->
setUnitsPerSegment( itemElem.attribute( QStringLiteral( 
"numUnitsPerSegment" ), QStringLiteral( 
"1.0" ) ).toDouble() );
 
 1057   layoutItem->
setMinimumBarWidth( itemElem.attribute( QStringLiteral( 
"minBarWidth" ), QStringLiteral( 
"50" ) ).toDouble() );
 
 1058   layoutItem->
setMaximumBarWidth( itemElem.attribute( QStringLiteral( 
"maxBarWidth" ), QStringLiteral( 
"150" ) ).toDouble() );
 
 1059   layoutItem->mSegmentMillimeters = itemElem.attribute( QStringLiteral( 
"segmentMillimeters" ), QStringLiteral( 
"0.0" ) ).toDouble();
 
 1060   layoutItem->
setMapUnitsPerScaleBarUnit( itemElem.attribute( QStringLiteral( 
"numMapUnitsPerScaleBarUnit" ), QStringLiteral( 
"1.0" ) ).toDouble() );
 
 1061   layoutItem->
setUnitLabel( itemElem.attribute( QStringLiteral( 
"unitLabel" ) ) );
 
 1066     f.fromString( itemElem.attribute( QStringLiteral( 
"font" ), QString() ) );
 
 1074   QDomNodeList fillColorList = itemElem.elementsByTagName( QStringLiteral( 
"fillColor" ) );
 
 1075   if ( !fillColorList.isEmpty() )
 
 1077     QDomElement fillColorElem = fillColorList.at( 0 ).toElement();
 
 1078     bool redOk, greenOk, blueOk, alphaOk;
 
 1079     int fillRed, fillGreen, fillBlue, fillAlpha;
 
 1081     fillRed = fillColorElem.attribute( QStringLiteral( 
"red" ) ).toDouble( &redOk );
 
 1082     fillGreen = fillColorElem.attribute( QStringLiteral( 
"green" ) ).toDouble( &greenOk );
 
 1083     fillBlue = fillColorElem.attribute( QStringLiteral( 
"blue" ) ).toDouble( &blueOk );
 
 1084     fillAlpha = fillColorElem.attribute( QStringLiteral( 
"alpha" ) ).toDouble( &alphaOk );
 
 1086     if ( redOk && greenOk && blueOk && alphaOk )
 
 1088       layoutItem->
fillSymbol()->
setColor( QColor( fillRed, fillGreen, fillBlue, fillAlpha ) );
 
 1093     layoutItem->
fillSymbol()->
setColor( QColor( itemElem.attribute( QStringLiteral( 
"brushColor" ), QStringLiteral( 
"#000000" ) ) ) );
 
 1097   QDomNodeList fillColor2List = itemElem.elementsByTagName( QStringLiteral( 
"fillColor2" ) );
 
 1098   if ( !fillColor2List.isEmpty() )
 
 1100     QDomElement fillColor2Elem = fillColor2List.at( 0 ).toElement();
 
 1101     bool redOk, greenOk, blueOk, alphaOk;
 
 1102     int fillRed, fillGreen, fillBlue, fillAlpha;
 
 1104     fillRed = fillColor2Elem.attribute( QStringLiteral( 
"red" ) ).toDouble( &redOk );
 
 1105     fillGreen = fillColor2Elem.attribute( QStringLiteral( 
"green" ) ).toDouble( &greenOk );
 
 1106     fillBlue = fillColor2Elem.attribute( QStringLiteral( 
"blue" ) ).toDouble( &blueOk );
 
 1107     fillAlpha = fillColor2Elem.attribute( QStringLiteral( 
"alpha" ) ).toDouble( &alphaOk );
 
 1109     if ( redOk && greenOk && blueOk && alphaOk )
 
 1116     layoutItem->
alternateFillSymbol()->
setColor( QColor( itemElem.attribute( QStringLiteral( 
"brush2Color" ), QStringLiteral( 
"#ffffff" ) ) ) );
 
 1119   std::unique_ptr< QgsLineSymbol > lineSymbol = std::make_unique< QgsLineSymbol >();
 
 1120   std::unique_ptr< QgsSimpleLineSymbolLayer > lineSymbolLayer = std::make_unique< QgsSimpleLineSymbolLayer >();
 
 1121   lineSymbolLayer->setWidth( itemElem.attribute( QStringLiteral( 
"outlineWidth" ), QStringLiteral( 
"0.3" ) ).toDouble() );
 
 1126   QDomNodeList strokeColorList = itemElem.elementsByTagName( QStringLiteral( 
"strokeColor" ) );
 
 1127   if ( !strokeColorList.isEmpty() )
 
 1129     QDomElement strokeColorElem = strokeColorList.at( 0 ).toElement();
 
 1130     bool redOk, greenOk, blueOk, alphaOk;
 
 1131     int strokeRed, strokeGreen, strokeBlue, strokeAlpha;
 
 1133     strokeRed = strokeColorElem.attribute( QStringLiteral( 
"red" ) ).toDouble( &redOk );
 
 1134     strokeGreen = strokeColorElem.attribute( QStringLiteral( 
"green" ) ).toDouble( &greenOk );
 
 1135     strokeBlue = strokeColorElem.attribute( QStringLiteral( 
"blue" ) ).toDouble( &blueOk );
 
 1136     strokeAlpha = strokeColorElem.attribute( QStringLiteral( 
"alpha" ) ).toDouble( &alphaOk );
 
 1138     if ( redOk && greenOk && blueOk && alphaOk )
 
 1140       lineSymbolLayer->setColor( QColor( strokeRed, strokeGreen, strokeBlue, strokeAlpha ) );
 
 1145     lineSymbolLayer->setColor( QColor( itemElem.attribute( QStringLiteral( 
"penColor" ), QStringLiteral( 
"#000000" ) ) ) );
 
 1147   lineSymbol->changeSymbolLayer( 0, lineSymbolLayer.release() );
 
 1153   QDomNodeList textColorList = itemElem.elementsByTagName( QStringLiteral( 
"textColor" ) );
 
 1154   if ( !textColorList.isEmpty() )
 
 1156     QDomElement textColorElem = textColorList.at( 0 ).toElement();
 
 1157     bool redOk, greenOk, blueOk, alphaOk;
 
 1158     int textRed, textGreen, textBlue, textAlpha;
 
 1160     textRed = textColorElem.attribute( QStringLiteral( 
"red" ) ).toDouble( &redOk );
 
 1161     textGreen = textColorElem.attribute( QStringLiteral( 
"green" ) ).toDouble( &greenOk );
 
 1162     textBlue = textColorElem.attribute( QStringLiteral( 
"blue" ) ).toDouble( &blueOk );
 
 1163     textAlpha = textColorElem.attribute( QStringLiteral( 
"alpha" ) ).toDouble( &alphaOk );
 
 1165     if ( redOk && greenOk && blueOk && alphaOk )
 
 1168       layoutItem->
setFontColor( QColor( textRed, textGreen, textBlue, textAlpha ) );
 
 1175     c.setNamedColor( itemElem.attribute( QStringLiteral( 
"fontColor" ), QStringLiteral( 
"#000000" ) ) );
 
 1182   QString styleString = itemElem.attribute( QStringLiteral( 
"style" ), QString() );
 
 1183   layoutItem->
setStyle( QObject::tr( styleString.toLocal8Bit().data() ) );
 
 1185   if ( itemElem.attribute( QStringLiteral( 
"unitType" ) ).isEmpty() )
 
 1188     switch ( itemElem.attribute( QStringLiteral( 
"units" ) ).toInt() )
 
 1212   QString mapId = itemElem.attribute( QStringLiteral( 
"mapId" ), QStringLiteral( 
"-1" ) );
 
 1213   if ( mapId != QLatin1String( 
"-1" ) && mapId2Uuid.contains( mapId ) )
 
 1227   restoreGeneralComposeItemProperties( layoutItem, itemElem );
 
 1237   QString mapId = itemElem.attribute( QStringLiteral( 
"map" ), QStringLiteral( 
"-1" ) );
 
 1238   if ( mapId != QLatin1String( 
"-1" ) && mapId2Uuid.contains( mapId ) )
 
 1248   layoutItem->
setTitle( itemElem.attribute( QStringLiteral( 
"title" ) ) );
 
 1249   if ( !itemElem.attribute( QStringLiteral( 
"titleAlignment" ) ).isEmpty() )
 
 1251     layoutItem->
setTitleAlignment( 
static_cast< Qt::AlignmentFlag 
>( itemElem.attribute( QStringLiteral( 
"titleAlignment" ) ).toInt() ) );
 
 1253   int colCount = itemElem.attribute( QStringLiteral( 
"columnCount" ), QStringLiteral( 
"1" ) ).toInt();
 
 1254   if ( colCount < 1 ) colCount = 1;
 
 1256   layoutItem->
setSplitLayer( itemElem.attribute( QStringLiteral( 
"splitLayer" ), QStringLiteral( 
"0" ) ).toInt() == 1 );
 
 1257   layoutItem->
setEqualColumnWidth( itemElem.attribute( QStringLiteral( 
"equalColumnWidth" ), QStringLiteral( 
"0" ) ).toInt() == 1 );
 
 1259   QDomNodeList stylesNodeList = itemElem.elementsByTagName( QStringLiteral( 
"styles" ) );
 
 1260   if ( !stylesNodeList.isEmpty() )
 
 1262     QDomNode stylesNode = stylesNodeList.at( 0 );
 
 1263     for ( 
int i = 0; i < stylesNode.childNodes().size(); i++ )
 
 1265       QDomElement styleElem = stylesNode.childNodes().at( i ).toElement();
 
 1267       style.
readXml( styleElem, QDomDocument() );
 
 1268       QString name = styleElem.attribute( QStringLiteral( 
"name" ) );
 
 1282   fontClr.setNamedColor( itemElem.attribute( QStringLiteral( 
"fontColor" ), QStringLiteral( 
"#000000" ) ) );
 
 1286   layoutItem->
setBoxSpace( itemElem.attribute( QStringLiteral( 
"boxSpace" ), QStringLiteral( 
"2.0" ) ).toDouble() );
 
 1287   layoutItem->
setColumnSpace( itemElem.attribute( QStringLiteral( 
"columnSpace" ), QStringLiteral( 
"2.0" ) ).toDouble() );
 
 1289   layoutItem->
setSymbolWidth( itemElem.attribute( QStringLiteral( 
"symbolWidth" ), QStringLiteral( 
"7.0" ) ).toDouble() );
 
 1290   layoutItem->
setSymbolHeight( itemElem.attribute( QStringLiteral( 
"symbolHeight" ), QStringLiteral( 
"14.0" ) ).toDouble() );
 
 1291   layoutItem->
setWmsLegendWidth( itemElem.attribute( QStringLiteral( 
"wmsLegendWidth" ), QStringLiteral( 
"50" ) ).toDouble() );
 
 1292   layoutItem->
setWmsLegendHeight( itemElem.attribute( QStringLiteral( 
"wmsLegendHeight" ), QStringLiteral( 
"25" ) ).toDouble() );
 
 1293   layoutItem->
setLineSpacing( itemElem.attribute( QStringLiteral( 
"lineSpacing" ), QStringLiteral( 
"1.0" ) ).toDouble() );
 
 1295   layoutItem->
setDrawRasterStroke( itemElem.attribute( QStringLiteral( 
"rasterBorder" ), QStringLiteral( 
"1" ) ) != QLatin1String( 
"0" ) );
 
 1297   layoutItem->
setRasterStrokeWidth( itemElem.attribute( QStringLiteral( 
"rasterBorderWidth" ), QStringLiteral( 
"0" ) ).toDouble() );
 
 1299   layoutItem->
setWrapString( itemElem.attribute( QStringLiteral( 
"wrapChar" ) ) );
 
 1301   layoutItem->mSizeToContents = itemElem.attribute( QStringLiteral( 
"resizeToContents" ), QStringLiteral( 
"1" ) ) != QLatin1String( 
"0" );
 
 1302   layoutItem->mLegendFilterByMap = itemElem.attribute( QStringLiteral( 
"legendFilterByMap" ), QStringLiteral( 
"0" ) ).toInt();
 
 1303   layoutItem->mFilterOutAtlas = itemElem.attribute( QStringLiteral( 
"legendFilterByAtlas" ), QStringLiteral( 
"0" ) ).toInt();
 
 1306   QDomElement layerTreeElem = itemElem.firstChildElement( QStringLiteral( 
"layer-tree" ) );
 
 1307   if ( layerTreeElem.isNull() )
 
 1308     layerTreeElem = itemElem.firstChildElement( QStringLiteral( 
"layer-tree-group" ) );
 
 1310   if ( !layerTreeElem.isNull() )
 
 1314       tree->resolveReferences( project, 
true );
 
 1315     layoutItem->setCustomLayerTree( tree );
 
 1319     layoutItem->setCustomLayerTree( 
nullptr );
 
 1325 bool QgsCompositionConverter::readAtlasXml( 
QgsLayoutAtlas *atlasItem, 
const QDomElement &itemElem, 
const QgsProject *project )
 
 1327   atlasItem->
setEnabled( itemElem.attribute( QStringLiteral( 
"enabled" ), QStringLiteral( 
"false" ) ) == QLatin1String( 
"true" ) );
 
 1330   QString layerId = itemElem.attribute( QStringLiteral( 
"coverageLayer" ) );
 
 1331   QString layerName = itemElem.attribute( QStringLiteral( 
"coverageLayerName" ) );
 
 1332   QString layerSource = itemElem.attribute( QStringLiteral( 
"coverageLayerSource" ) );
 
 1333   QString layerProvider = itemElem.attribute( QStringLiteral( 
"coverageLayerProvider" ) );
 
 1338   atlasItem->
setPageNameExpression( itemElem.attribute( QStringLiteral( 
"pageNameExpression" ), QString() ) );
 
 1339   QString errorString;
 
 1340   atlasItem->
setFilenameExpression( itemElem.attribute( QStringLiteral( 
"filenamePattern" ), QString() ), errorString );
 
 1342   atlasItem->
setSortFeatures( itemElem.attribute( QStringLiteral( 
"sortFeatures" ), QStringLiteral( 
"false" ) ) == QLatin1String( 
"true" ) );
 
 1345     atlasItem->
setSortExpression( itemElem.attribute( QStringLiteral( 
"sortKey" ), QString() ) );
 
 1346     atlasItem->
setSortAscending( itemElem.attribute( QStringLiteral( 
"sortAscending" ), QStringLiteral( 
"true" ) ) == QLatin1String( 
"true" ) );
 
 1348   atlasItem->
setFilterFeatures( itemElem.attribute( QStringLiteral( 
"filterFeatures" ), QStringLiteral( 
"false" ) ) == QLatin1String( 
"true" ) );
 
 1351     QString expErrorString;
 
 1352     atlasItem->
setFilterExpression( itemElem.attribute( QStringLiteral( 
"featureFilter" ), QString() ), expErrorString );
 
 1356   atlasItem->
setHideCoverage( itemElem.attribute( QStringLiteral( 
"hideCoverage" ), QStringLiteral( 
"false" ) ) == QLatin1String( 
"true" ) );
 
 1362 bool QgsCompositionConverter::readHtmlXml( 
QgsLayoutItemHtml *layoutItem, 
const QDomElement &itemElem, 
const QgsProject *project )
 
 1365   readOldComposerObjectXml( layoutItem, itemElem );
 
 1369   QDomNodeList frameList = itemElem.elementsByTagName( QStringLiteral( 
"ComposerFrame" ) );
 
 1370   for ( 
int i = 0; i < frameList.size(); ++i )
 
 1372     QDomElement frameElem = frameList.at( i ).toElement();
 
 1374     restoreGeneralComposeItemProperties( newFrame, frameElem );
 
 1376     double x = itemElem.attribute( QStringLiteral( 
"sectionX" ) ).toDouble();
 
 1377     double y = itemElem.attribute( QStringLiteral( 
"sectionY" ) ).toDouble();
 
 1378     double width = itemElem.attribute( QStringLiteral( 
"sectionWidth" ) ).toDouble();
 
 1379     double height = itemElem.attribute( QStringLiteral( 
"sectionHeight" ) ).toDouble();
 
 1381     newFrame->
setHidePageIfEmpty( itemElem.attribute( QStringLiteral( 
"hidePageIfEmpty" ), QStringLiteral( 
"0" ) ).toInt() );
 
 1382     newFrame->
setHideBackgroundIfEmpty( itemElem.attribute( QStringLiteral( 
"hideBackgroundIfEmpty" ), QStringLiteral( 
"0" ) ).toInt() );
 
 1383     layoutItem->
addFrame( newFrame, 
false );
 
 1388   if ( !contentModeOK )
 
 1390     layoutItem->
setContentMode( QgsLayoutItemHtml::ContentMode::Url );
 
 1392   layoutItem->
setEvaluateExpressions( itemElem.attribute( QStringLiteral( 
"evaluateExpressions" ), QStringLiteral( 
"true" ) ) == QLatin1String( 
"true" ) );
 
 1393   layoutItem->
setUseSmartBreaks( itemElem.attribute( QStringLiteral( 
"useSmartBreaks" ), QStringLiteral( 
"true" ) ) == QLatin1String( 
"true" ) );
 
 1394   layoutItem->
setMaxBreakDistance( itemElem.attribute( QStringLiteral( 
"maxBreakDistance" ), QStringLiteral( 
"10" ) ).toDouble() );
 
 1395   layoutItem->
setHtml( itemElem.attribute( QStringLiteral( 
"html" ) ) );
 
 1396   layoutItem->
setUserStylesheet( itemElem.attribute( QStringLiteral( 
"stylesheet" ) ) );
 
 1397   layoutItem->
setUserStylesheetEnabled( itemElem.attribute( QStringLiteral( 
"stylesheetEnabled" ), QStringLiteral( 
"false" ) ) == QLatin1String( 
"true" ) );
 
 1400   QString urlString = itemElem.attribute( QStringLiteral( 
"url" ) );
 
 1401   if ( !urlString.isEmpty() )
 
 1403     layoutItem->
setUrl( urlString );
 
 1414   readOldComposerObjectXml( layoutItem, itemElem );
 
 1418   QDomNodeList frameList = itemElem.elementsByTagName( QStringLiteral( 
"ComposerFrame" ) );
 
 1419   for ( 
int i = 0; i < frameList.size(); ++i )
 
 1421     QDomElement frameElem = frameList.at( i ).toElement();
 
 1423     restoreGeneralComposeItemProperties( newFrame, frameElem );
 
 1425     double x = itemElem.attribute( QStringLiteral( 
"sectionX" ) ).toDouble();
 
 1426     double y = itemElem.attribute( QStringLiteral( 
"sectionY" ) ).toDouble();
 
 1427     double width = itemElem.attribute( QStringLiteral( 
"sectionWidth" ) ).toDouble();
 
 1428     double height = itemElem.attribute( QStringLiteral( 
"sectionHeight" ) ).toDouble();
 
 1430     newFrame->
setHidePageIfEmpty( itemElem.attribute( QStringLiteral( 
"hidePageIfEmpty" ), QStringLiteral( 
"0" ) ).toInt() );
 
 1431     newFrame->
setHideBackgroundIfEmpty( itemElem.attribute( QStringLiteral( 
"hideBackgroundIfEmpty" ), QStringLiteral( 
"0" ) ).toInt() );
 
 1432     layoutItem->
addFrame( newFrame, 
false );
 
 1436   layoutItem->
setEmptyTableMessage( itemElem.attribute( QStringLiteral( 
"emptyTableMessage" ), QObject::tr( 
"No matching records" ) ) );
 
 1437   layoutItem->
setShowEmptyRows( itemElem.attribute( QStringLiteral( 
"showEmptyRows" ), QStringLiteral( 
"0" ) ).toInt() );
 
 1441     headerFont.fromString( itemElem.attribute( QStringLiteral( 
"headerFont" ), QString() ) );
 
 1444   headerFormat.
setFont( headerFont );
 
 1445   if ( headerFont.pointSizeF() > 0 )
 
 1447     headerFormat.
setSize( headerFont.pointSizeF() );
 
 1450   else if ( headerFont.pixelSize() > 0 )
 
 1452     headerFormat.
setSize( headerFont.pixelSize() );
 
 1463     contentFont.fromString( itemElem.attribute( QStringLiteral( 
"contentFont" ), QString() ) );
 
 1466   contentFormat.
setFont( contentFont );
 
 1467   if ( contentFont.pointSizeF() > 0 )
 
 1469     contentFormat.
setSize( contentFont.pointSizeF() );
 
 1472   else if ( contentFont.pixelSize() > 0 )
 
 1474     contentFormat.
setSize( contentFont.pixelSize() );
 
 1480   layoutItem->
setCellMargin( itemElem.attribute( QStringLiteral( 
"cellMargin" ), QStringLiteral( 
"1.0" ) ).toDouble() );
 
 1481   layoutItem->
setGridStrokeWidth( itemElem.attribute( QStringLiteral( 
"gridStrokeWidth" ), QStringLiteral( 
"0.5" ) ).toDouble() );
 
 1482   layoutItem->
setHorizontalGrid( itemElem.attribute( QStringLiteral( 
"horizontalGrid" ), QStringLiteral( 
"1" ) ).toInt() );
 
 1483   layoutItem->
setVerticalGrid( itemElem.attribute( QStringLiteral( 
"verticalGrid" ), QStringLiteral( 
"1" ) ).toInt() );
 
 1484   layoutItem->
setShowGrid( itemElem.attribute( QStringLiteral( 
"showGrid" ), QStringLiteral( 
"1" ) ).toInt() );
 
 1493   QDomNodeList columnsList = itemElem.elementsByTagName( QStringLiteral( 
"displayColumns" ) );
 
 1494   if ( !columnsList.isEmpty() )
 
 1496     QDomElement columnsElem = columnsList.at( 0 ).toElement();
 
 1497     QDomNodeList columnEntryList = columnsElem.elementsByTagName( QStringLiteral( 
"column" ) );
 
 1498     for ( 
int i = 0; i < columnEntryList.size(); ++i )
 
 1500       QDomElement columnElem = columnEntryList.at( i ).toElement();
 
 1502       column.mHAlignment = 
static_cast< Qt::AlignmentFlag 
>( columnElem.attribute( QStringLiteral( 
"hAlignment" ), QString::number( Qt::AlignLeft ) ).toInt() );
 
 1503       column.mVAlignment = 
static_cast< Qt::AlignmentFlag 
>( columnElem.attribute( QStringLiteral( 
"vAlignment" ), QString::number( Qt::AlignVCenter ) ).toInt() );
 
 1504       column.mHeading = columnElem.attribute( QStringLiteral( 
"heading" ), QString() );
 
 1505       column.mAttribute = columnElem.attribute( QStringLiteral( 
"attribute" ), QString() );
 
 1506       column.mSortByRank = columnElem.attribute( QStringLiteral( 
"sortByRank" ), QStringLiteral( 
"0" ) ).toInt();
 
 1507       column.mSortOrder = 
static_cast< Qt::SortOrder 
>( columnElem.attribute( QStringLiteral( 
"sortOrder" ), QString::number( Qt::AscendingOrder ) ).toInt() );
 
 1508       column.mWidth = columnElem.attribute( QStringLiteral( 
"width" ), QStringLiteral( 
"0.0" ) ).toDouble();
 
 1510       QDomNodeList bgColorList = columnElem.elementsByTagName( QStringLiteral( 
"backgroundColor" ) );
 
 1511       if ( !bgColorList.isEmpty() )
 
 1513         QDomElement bgColorElem = bgColorList.at( 0 ).toElement();
 
 1514         bool redOk, greenOk, blueOk, alphaOk;
 
 1515         int bgRed, bgGreen, bgBlue, bgAlpha;
 
 1516         bgRed = bgColorElem.attribute( QStringLiteral( 
"red" ) ).toDouble( &redOk );
 
 1517         bgGreen = bgColorElem.attribute( QStringLiteral( 
"green" ) ).toDouble( &greenOk );
 
 1518         bgBlue = bgColorElem.attribute( QStringLiteral( 
"blue" ) ).toDouble( &blueOk );
 
 1519         bgAlpha = bgColorElem.attribute( QStringLiteral( 
"alpha" ) ).toDouble( &alphaOk );
 
 1520         if ( redOk && greenOk && blueOk && alphaOk )
 
 1522           column.mBackgroundColor = QColor( bgRed, bgGreen, bgBlue, bgAlpha );
 
 1525       layoutItem->
mColumns.append( column );
 
 1537   QDomNodeList stylesList = itemElem.elementsByTagName( QStringLiteral( 
"cellStyles" ) );
 
 1538   if ( !stylesList.isEmpty() )
 
 1540     QDomElement stylesElem = stylesList.at( 0 ).toElement();
 
 1542     QMap< QgsLayoutTable::CellStyleGroup, QString >::const_iterator it = layoutItem->mCellStyleNames.constBegin();
 
 1543     for ( ; it != layoutItem->mCellStyleNames.constEnd(); ++it )
 
 1545       QString styleName = it.value();
 
 1546       QDomNodeList styleList = stylesElem.elementsByTagName( styleName );
 
 1547       if ( !styleList.isEmpty() )
 
 1549         QDomElement styleElem = styleList.at( 0 ).toElement();
 
 1558   QString layerId = itemElem.attribute( QStringLiteral( 
"vectorLayer" ) );
 
 1559   QString layerName = itemElem.attribute( QStringLiteral( 
"vectorLayerName" ) );
 
 1560   QString layerSource = itemElem.attribute( QStringLiteral( 
"vectorLayerSource" ) );
 
 1561   QString layerProvider = itemElem.attribute( QStringLiteral( 
"vectorLayerProvider" ) );
 
 1569 bool QgsCompositionConverter::readGroupXml( 
QgsLayoutItemGroup *layoutItem, 
const QDomElement &itemElem, 
const QgsProject *project, 
const QList< QgsLayoutObject * > &items )
 
 1573   restoreGeneralComposeItemProperties( layoutItem, itemElem );
 
 1575   QDomNodeList nodes = itemElem.elementsByTagName( 
"ComposerItemGroupElement" );
 
 1576   for ( 
int i = 0, n = nodes.size(); i < n; ++i )
 
 1578     QDomElement groupElement = nodes.at( i ).toElement();
 
 1579     QString elementUuid = groupElement.attribute( 
"uuid" );
 
 1594 template <
class T, 
class T2>
 
 1595 bool QgsCompositionConverter::readPolyXml( T *layoutItem, 
const QDomElement &itemElem, 
const QgsProject *project )
 
 1597   restoreGeneralComposeItemProperties( layoutItem, itemElem );
 
 1598   QDomNodeList nodeList = itemElem.elementsByTagName( QStringLiteral( 
"node" ) );
 
 1599   if ( !nodeList.isEmpty() )
 
 1602     for ( 
int i = 0; i < nodeList.length(); i++ )
 
 1604       QDomElement node = nodeList.at( i ).toElement();
 
 1605       polygon.append( QPointF( node.attribute( QStringLiteral( 
"x" ) ).toDouble( ), node.attribute( QStringLiteral( 
"y" ) ).toDouble() ) );
 
 1607     layoutItem->setNodes( polygon );
 
 1609   if ( itemElem.elementsByTagName( QStringLiteral( 
"symbol" ) ).size() )
 
 1611     QDomElement symbolElement = itemElem.elementsByTagName( QStringLiteral( 
"symbol" ) ).at( 0 ).toElement();
 
 1615     T2 *styleSymbol = QgsSymbolLayerUtils::loadSymbol<T2>( symbolElement, context );
 
 1617       layoutItem->setSymbol( styleSymbol );
 
 1620   layoutItem->setFrameEnabled( 
false );
 
 1621   layoutItem->setBackgroundEnabled( 
false );
 
 1626 bool QgsCompositionConverter::readXml( 
QgsLayoutItem *layoutItem, 
const QDomElement &itemElem )
 
 1628   if ( itemElem.isNull() )
 
 1633   readOldComposerObjectXml( layoutItem, itemElem );
 
 1636   layoutItem->mUuid = itemElem.attribute( QStringLiteral( 
"uuid" ), QUuid::createUuid().toString() );
 
 1639   layoutItem->mTemplateUuid = itemElem.attribute( QStringLiteral( 
"templateUuid" ) );
 
 1642   QString 
id = itemElem.attribute( QStringLiteral( 
"id" ), QString() );
 
 1643   layoutItem->
setId( 
id );
 
 1646   QString frame = itemElem.attribute( QStringLiteral( 
"frame" ) );
 
 1647   layoutItem->
setFrameEnabled( frame.compare( QLatin1String( 
"true" ), Qt::CaseInsensitive ) == 0 ) ;
 
 1650   QString background = itemElem.attribute( QStringLiteral( 
"background" ) );
 
 1651   layoutItem->
setBackgroundEnabled( background.compare( QLatin1String( 
"true" ), Qt::CaseInsensitive ) == 0 );
 
 1654   QString positionLock = itemElem.attribute( QStringLiteral( 
"positionLock" ) );
 
 1655   layoutItem->
setLocked( positionLock.compare( QLatin1String( 
"true" ), Qt::CaseInsensitive ) == 0 );
 
 1658   layoutItem->
setVisibility( itemElem.attribute( QStringLiteral( 
"visibility" ), QStringLiteral( 
"1" ) ) != QLatin1String( 
"0" ) );
 
 1660   layoutItem->mParentGroupUuid = itemElem.attribute( QStringLiteral( 
"groupUuid" ) );
 
 1661   if ( !layoutItem->mParentGroupUuid.isEmpty() )
 
 1665       group->addItem( layoutItem );
 
 1668   layoutItem->mTemplateUuid = itemElem.attribute( QStringLiteral( 
"templateUuid" ) );
 
 1671   QRectF position = itemPosition( layoutItem, itemElem );
 
 1676   layoutItem->setZValue( itemElem.attribute( QStringLiteral( 
"zValue" ) ).toDouble() );
 
 1679   QDomNodeList frameColorList = itemElem.elementsByTagName( QStringLiteral( 
"FrameColor" ) );
 
 1680   if ( !frameColorList.isEmpty() )
 
 1682     QDomElement frameColorElem = frameColorList.at( 0 ).toElement();
 
 1683     bool redOk, greenOk, blueOk, alphaOk, widthOk;
 
 1684     int penRed, penGreen, penBlue, penAlpha;
 
 1687     penWidth = itemElem.attribute( QStringLiteral( 
"outlineWidth" ) ).toDouble( &widthOk );
 
 1688     penRed = frameColorElem.attribute( QStringLiteral( 
"red" ) ).toDouble( &redOk );
 
 1689     penGreen = frameColorElem.attribute( QStringLiteral( 
"green" ) ).toDouble( &greenOk );
 
 1690     penBlue = frameColorElem.attribute( QStringLiteral( 
"blue" ) ).toDouble( &blueOk );
 
 1691     penAlpha = frameColorElem.attribute( QStringLiteral( 
"alpha" ) ).toDouble( &alphaOk );
 
 1694     if ( redOk && greenOk && blueOk && alphaOk && widthOk )
 
 1701       layoutItem->setPen( framePen );
 
 1708   QDomNodeList bgColorList = itemElem.elementsByTagName( QStringLiteral( 
"BackgroundColor" ) );
 
 1709   if ( !bgColorList.isEmpty() )
 
 1711     QDomElement bgColorElem = bgColorList.at( 0 ).toElement();
 
 1712     bool redOk, greenOk, blueOk, alphaOk;
 
 1713     int bgRed, bgGreen, bgBlue, bgAlpha;
 
 1714     bgRed = bgColorElem.attribute( QStringLiteral( 
"red" ) ).toDouble( &redOk );
 
 1715     bgGreen = bgColorElem.attribute( QStringLiteral( 
"green" ) ).toDouble( &greenOk );
 
 1716     bgBlue = bgColorElem.attribute( QStringLiteral( 
"blue" ) ).toDouble( &blueOk );
 
 1717     bgAlpha = bgColorElem.attribute( QStringLiteral( 
"alpha" ) ).toDouble( &alphaOk );
 
 1718     if ( redOk && greenOk && blueOk && alphaOk )
 
 1720       layoutItem->mBackgroundColor = QColor( bgRed, bgGreen, bgBlue, bgAlpha );
 
 1721       layoutItem->setBrush( QBrush( layoutItem->mBackgroundColor, Qt::SolidPattern ) );
 
 1731   if ( itemElem.hasAttribute( QStringLiteral( 
"opacity" ) ) )
 
 1733     layoutItem->
setItemOpacity( itemElem.attribute( QStringLiteral( 
"opacity" ), QStringLiteral( 
"1" ) ).toDouble() );
 
 1737     layoutItem->
setItemOpacity( 1.0 - itemElem.attribute( QStringLiteral( 
"transparency" ), QStringLiteral( 
"0" ) ).toInt() / 100.0 );
 
 1740   layoutItem->mExcludeFromExports = itemElem.attribute( QStringLiteral( 
"excludeFromExports" ), QStringLiteral( 
"0" ) ).toInt();
 
 1741   layoutItem->mEvaluatedExcludeFromExports = layoutItem->mExcludeFromExports;
 
 1746   layoutItem->
setItemRotation( itemElem.attribute( QStringLiteral( 
"itemRotation" ), QStringLiteral( 
"0" ) ).toDouble(), 
false );
 
 1748   layoutItem->mBlockUndoCommands = 
false;
 
 1755 bool QgsCompositionConverter::readOldComposerObjectXml( 
QgsLayoutObject *layoutItem,
 
 1756     const QDomElement &itemElem )
 
 1758   if ( itemElem.isNull() )
 
 1766   QDomNode propsNode = itemElem.namedItem( QStringLiteral( 
"dataDefinedProperties" ) );
 
 1767   if ( !propsNode.isNull() )
 
 1775     exp = QStringLiteral( 
"100.0 - (%1)" ).arg( exp );
 
 1787 void QgsCompositionConverter::readOldDataDefinedPropertyMap( 
const QDomElement &itemElem, 
QgsPropertyCollection &dataDefinedProperties )
 
 1790   QgsPropertiesDefinition::const_iterator i = defs.constBegin();
 
 1791   for ( ; i != defs.constEnd(); ++i )
 
 1793     QString elemName = i.value().name();
 
 1794     QDomNodeList ddNodeList = itemElem.elementsByTagName( elemName );
 
 1795     if ( !ddNodeList.isEmpty() )
 
 1797       QDomElement ddElem = ddNodeList.at( 0 ).toElement();
 
 1800         dataDefinedProperties.
setProperty( i.key(), prop );
 
 1813   QString active = ddElem.attribute( QStringLiteral( 
"active" ) );
 
 1814   bool isActive = 
false;
 
 1815   if ( active.compare( QLatin1String( 
"true" ), Qt::CaseInsensitive ) == 0 )
 
 1819   QString 
field = ddElem.attribute( QStringLiteral( 
"field" ) );
 
 1820   QString expr = ddElem.attribute( QStringLiteral( 
"expr" ) );
 
 1822   QString useExpr = ddElem.attribute( QStringLiteral( 
"useExpr" ) );
 
 1823   bool isExpression = 
false;
 
 1824   if ( useExpr.compare( QLatin1String( 
"true" ), Qt::CaseInsensitive ) == 0 )
 
 1826     isExpression = 
true;
 
virtual bool readXml(const QDomElement &collectionElem, const QgsPropertiesDefinition &definitions)
Reads property collection state from an XML element.
DataDefinedProperty
Composition data defined properties for different item types.
@ LegendTitle
Legend title.
@ PaperOrientation
Paper orientation.
@ MapYMax
Map extent y maximum.
@ MapStylePreset
Layer and style map theme.
@ MapAtlasMargin
Map atlas margin.
@ FrameColor
Item frame color.
@ ItemWidth
Width of item.
@ MapYMin
Map extent y minimum.
@ ItemHeight
Height of item.
@ MapXMin
Map extent x minimum.
@ BlendMode
Item blend mode.
@ ScalebarFillColor2
Scalebar secondary fill color.
@ ExcludeFromExports
Exclude item from exports.
@ NumPages
Number of pages in composition.
@ PictureSvgBackgroundColor
SVG background color.
@ ItemRotation
Rotation of item.
@ MapRotation
Map rotation.
@ SourceUrl
Html source url.
@ LegendColumnCount
Legend column count.
@ PictureSvgStrokeWidth
SVG stroke width.
@ ScalebarFillColor
Scalebar fill color.
@ MapLayers
Map layer set.
@ PictureSvgStrokeColor
SVG stroke color.
@ PageNumber
Page number for item placement.
@ ScalebarLineColor
Scalebar line color.
@ Transparency
Item transparency (deprecated)
@ MapXMax
Map extent x maximum.
@ TestProperty
Dummy property with no effect on item.
@ AllProperties
All properties for item.
@ PresetPaperSize
Preset paper size for composition.
@ BackgroundColor
Item background color.
@ PositionY
Y position on page.
@ PaperHeight
Paper height.
@ PositionX
X position on page.
@ ScalebarLineWidth
Scalebar line width.
@ PictureSource
Picture source url.
MarkerMode
The MarkerMode enum is the old QGIS 2.x arrow marker mode.
static bool isCompositionTemplate(const QDomDocument &document)
Check if the given document is a composition template.
static std::unique_ptr< QgsPrintLayout > createLayoutFromCompositionXml(const QDomElement &composerElement, QgsProject *project)
createLayoutFromCompositionXml is a factory that creates layout instances from a QGIS 2....
static QDomDocument convertCompositionTemplate(const QDomDocument &document, QgsProject *project)
Convert a composition template document to a layout template.
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....
This class represents a coordinate reference system (CRS).
bool readXml(const QDomNode &node)
Restores state from the given DOM node.
static QgsFillSymbol * createSimple(const QVariantMap &properties)
Create a fill symbol with one symbol layer: SimpleFill with specified properties.
static bool setFromXmlChildNode(QFont &font, const QDomElement &element, const QString &childNode)
Sets the properties of a font to match the properties stored in an XML child node.
Namespace with helper functions for layer tree operations.
static QgsLayerTree * readXml(QDomElement &element, const QgsReadWriteContext &context)
Load the layer tree from an XML element.
Class used to render QgsLayout as an atlas, by iterating over the features from an associated vector ...
bool filterFeatures() const
Returns true if features should be filtered in the coverage layer.
void setCoverageLayer(QgsVectorLayer *layer)
Sets the coverage layer to use for the atlas features.
bool setFilterExpression(const QString &expression, QString &errorString)
Sets the expression used for filtering features in the coverage layer.
void setSortAscending(bool ascending)
Sets whether features should be sorted in an ascending order.
void setEnabled(bool enabled)
Sets whether the atlas is enabled.
void setPageNameExpression(const QString &expression)
Sets the expression (or field name) used for calculating the page name.
bool setFilenameExpression(const QString &expression, QString &errorString)
Sets the filename expression used for generating output filenames for each atlas page.
void setSortFeatures(bool enabled)
Sets whether features should be sorted in the atlas.
void setSortExpression(const QString &expression)
Sets the expression (or field name) to use for sorting features.
void setFilterFeatures(bool filtered)
Sets whether features should be filtered in the coverage layer.
bool sortFeatures() const
Returns true if features should be sorted in the atlas.
void setHideCoverage(bool hide)
Sets whether the coverage layer should be hidden in map items in the layouts.
Base class for frame items, which form a layout multiframe item.
void setContentSection(const QRectF §ion)
Sets the visible part of the multiframe's content which is visible within this frame (relative to the...
void setHideBackgroundIfEmpty(bool hideBackgroundIfEmpty)
Sets whether the background and frame stroke should be hidden if this frame is empty.
void setHidePageIfEmpty(bool hidePageIfEmpty)
Sets whether the page should be hidden (ie, not included in layout exports) if this frame is empty.
A layout table subclass that displays attributes from a vector layer.
void setVectorLayer(QgsVectorLayer *layer)
Sets the vector layer from which to display feature attributes.
A container for grouping several QgsLayoutItems.
void addItem(QgsLayoutItem *item)
Adds an item to the group.
A layout multiframe subclass for HTML content.
void setUrl(const QUrl &url)
Sets the url for content to display in the item when the item is using the QgsLayoutItemHtml::Url mod...
ContentMode
Source modes for the HTML content to render in the item.
void setEvaluateExpressions(bool evaluateExpressions)
Sets whether the html item will evaluate QGIS expressions prior to rendering the HTML content.
void setMaxBreakDistance(double distance)
Sets the maximum distance allowed when calculating where to place page breaks in the html.
void setUserStylesheetEnabled(bool enabled)
Sets whether user stylesheets are enabled for the HTML content.
void setHtml(const QString &html)
Sets the html to display in the item when the item is using the QgsLayoutItemHtml::ManualHtml mode.
void setUseSmartBreaks(bool useSmartBreaks)
Sets whether the html item should use smart breaks.
void setUserStylesheet(const QString &stylesheet)
Sets the user stylesheet CSS rules to use while rendering the HTML content.
void setContentMode(ContentMode mode)
Sets the source mode for item's HTML content.
void loadHtml(bool useCache=false, const QgsExpressionContext *context=nullptr)
Reloads the html source from the url and redraws the item.
A layout item subclass for text labels.
void setHAlign(Qt::AlignmentFlag alignment)
Sets the horizontal alignment of the label.
void setMarginX(double margin)
Sets the horizontal margin between the edge of the frame and the label contents, in layout units.
void setText(const QString &text)
Sets the label's preset text.
void setMarginY(double margin)
Sets the vertical margin between the edge of the frame and the label contents, in layout units.
void setFont(const QFont &font)
Sets the label's current font.
void setMode(Mode mode)
Sets the label's current mode, allowing the label to switch between font based and HTML based renderi...
void setVAlign(Qt::AlignmentFlag alignment)
Sets for the vertical alignment of the label.
void setFontColor(const QColor &color)
Sets the label font color.
A layout item subclass for map legends.
void setSplitLayer(bool enabled)
Sets whether the legend items from a single layer can be split over multiple columns.
void setColumnSpace(double spacing)
Sets the legend column spacing.
void setBoxSpace(double space)
Sets the legend box space.
void setEqualColumnWidth(bool equalize)
Sets whether column widths should be equalized.
void setDrawRasterStroke(bool enabled)
Sets whether a stroke will be drawn around raster symbol items.
void setSymbolWidth(double width)
Sets the legend symbol width.
void setLinkedMap(QgsLayoutItemMap *map)
Sets the map to associate with the legend.
void setWmsLegendWidth(double width)
Sets the WMS legend width.
void setTitle(const QString &title)
Sets the legend title.
void setFontColor(const QColor &color)
Sets the legend font color.
void setRasterStrokeColor(const QColor &color)
Sets the stroke color for the stroke drawn around raster symbol items.
void setStyle(QgsLegendStyle::Style component, const QgsLegendStyle &style)
Sets the style of component to style for the legend.
void setLineSpacing(double spacing)
Sets the spacing in-between multiple lines.
void setSymbolHeight(double height)
Sets the legend symbol height.
void setWmsLegendHeight(double height)
Sets the WMS legend height.
void setRasterStrokeWidth(double width)
Sets the stroke width for the stroke drawn around raster symbol items.
void setTitleAlignment(Qt::AlignmentFlag alignment)
Sets the alignment of the legend title.
void setWrapString(const QString &string)
Sets the legend text wrapping string.
void setColumnCount(int count)
Sets the legend column count.
An individual grid which is drawn above the map content in a QgsLayoutItemMap.
GridStyle
Grid drawing style.
void setFrameFillColor2(const QColor &color)
Sets the second fill color used for the grid frame.
void setAnnotationFormat(const AnnotationFormat format)
Sets the format for drawing grid annotations.
void setIntervalY(double interval)
Sets the interval between grid lines in the y-direction.
void setAnnotationEnabled(const bool enabled)
Sets whether annotations should be shown for the grid.
QgsTextFormat annotationTextFormat() const
Returns the text format used when rendering grid annotations.
void setFramePenColor(const QColor &color)
Sets the color of the stroke drawn in the grid frame.
void setFramePenSize(const double width)
Sets the width of the stroke drawn in the grid frame.
AnnotationPosition
Position for grid annotations.
void setAnnotationPosition(AnnotationPosition position, BorderSide side)
Sets the position for the grid annotations on a specified side of the map frame.
void setIntervalX(double interval)
Sets the interval between grid lines in the x-direction.
void setCrossLength(const double length)
Sets the length (in layout units) of the cross segments drawn for the grid.
void setEnabled(bool enabled) override
Controls whether the item will be drawn.
void setAnnotationFrameDistance(const double distance)
Sets the distance between the map frame and annotations.
void setAnnotationTextFormat(const QgsTextFormat &format)
Sets the text format to use when rendering grid annotations.
void setBlendMode(const QPainter::CompositionMode mode)
Sets the blending mode used for drawing the grid.
void setFrameStyle(const FrameStyle style)
Sets the grid frame style.
void setAnnotationPrecision(const int precision)
Sets the coordinate precision for grid annotations.
void setLineSymbol(QgsLineSymbol *symbol)
Sets the line symbol used for drawing grid lines.
AnnotationFormat
Format for displaying grid annotations.
AnnotationDirection
Direction of grid annotations.
void setOffsetY(double offset)
Sets the offset for grid lines in the y-direction.
FrameStyle
Style for grid frame.
void setFrameWidth(const double width)
Sets the grid frame width (in layout units).
void setFrameFillColor1(const QColor &color)
Sets the first fill color used for the grid frame.
void setOffsetX(double offset)
Sets the offset for grid lines in the x-direction.
void setAnnotationDirection(AnnotationDirection direction, BorderSide side)
Sets the direction for drawing frame annotations for the specified map side.
void setStyle(GridStyle style)
Sets the grid style, which controls how the grid is drawn over the map's contents.
An individual overview which is drawn above the map content in a QgsLayoutItemMap,...
Layout graphical items for displaying a map.
void setFollowVisibilityPreset(bool follow)
Sets whether the map should follow a map theme.
void setFollowVisibilityPresetName(const QString &name)
Sets preset name for map rendering.
void setKeepLayerSet(bool enabled)
Sets whether the stored layer set should be used or the current layer set of the associated project.
AtlasScalingMode
Scaling modes used for the serial rendering (atlas)
void updateBoundingRect()
Updates the bounding rect of this item. Call this function before doing any changes related to annota...
void setDrawAnnotations(bool draw)
Sets whether annotations are drawn within the map.
void setExtent(const QgsRectangle &extent)
Sets a new extent for the map.
void setAtlasScalingMode(AtlasScalingMode mode)
Sets the current atlas scaling mode.
void setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the map's preset crs (coordinate reference system).
void setAtlasMargin(double margin)
Sets the margin size (percentage) used when the map is in atlas mode.
void setMapRotation(double rotation)
Sets the rotation for the map - this does not affect the layout item shape, only the way the map is d...
QgsCoordinateReferenceSystem crs() const
Returns coordinate reference system used for rendering the map.
Item representing the paper in a layout.
void setPageSize(const QgsLayoutSize &size)
Sets the size of the page.
static QgsLayoutItemPage * create(QgsLayout *layout)
Returns a new page item for the specified layout.
A layout item subclass that displays SVG files or raster format images (jpg, png, ....
void setPictureAnchor(QgsLayoutItem::ReferencePoint anchor)
Sets the picture's anchor point, which controls how it is placed within the picture item's frame.
void setLinkedMap(QgsLayoutItemMap *map)
Sets the map object for rotation.
void setPicturePath(const QString &path, Format format=FormatUnknown)
Sets the source path of the image (may be svg or a raster format).
ResizeMode
Controls how pictures are scaled within the item's frame.
Layout item for node based polygon shapes.
Layout item for node based polyline shapes.
void setArrowHeadWidth(double width)
Sets the width of line arrow heads in mm.
void setEndMarker(MarkerMode mode)
Sets the end marker mode, which controls what marker is drawn at the end of the line.
void setEndSvgMarkerPath(const QString &path)
Sets the path to a SVG marker to draw at the end of the line.
void setArrowHeadStrokeWidth(double width)
Sets the pen width in millimeters for the stroke of the arrow head.
void setArrowHeadFillColor(const QColor &color)
Sets the color used to fill the arrow head.
void setArrowHeadStrokeColor(const QColor &color)
Sets the color used to draw the stroke around the arrow head.
void setStartMarker(MarkerMode mode)
Sets the start marker mode, which controls what marker is drawn at the start of the line.
void setStartSvgMarkerPath(const QString &path)
Sets the path to a SVG marker to draw at the start of the line.
A layout item subclass for scale bars.
void setNumberOfSegments(int segments)
Sets the number of segments included in the scalebar.
QgsFillSymbol * alternateFillSymbol() const
Returns the secondary fill symbol used to render the scalebar (only used for some scalebar types).
void setMinimumBarWidth(double minWidth)
Sets the minimum width (in millimeters) for scale bar segments.
QgsFillSymbol * fillSymbol() const
Returns the primary fill symbol used to render the scalebar (only used for some scalebar types).
void setMaximumBarWidth(double maxWidth)
Sets the maximum width (in millimeters) for scale bar segments.
void setSegmentSizeMode(QgsScaleBarSettings::SegmentSizeMode mode)
Sets the size mode for scale bar segments.
void setDivisionLineSymbol(QgsLineSymbol *symbol)
Sets the line symbol used to render the scalebar divisions (only used for some scalebar types).
void setLabelBarSpace(double space)
Sets the spacing (in millimeters) between labels and the scalebar.
void setUnits(QgsUnitTypes::DistanceUnit units)
Sets the distance units used by the scalebar.
void setAlignment(QgsScaleBarSettings::Alignment alignment)
Sets the scalebar alignment.
void setLineSymbol(QgsLineSymbol *symbol)
Sets the line symbol used to render the scalebar (only used for some scalebar types).
void setStyle(const QString &name)
Sets the scale bar style by name.
void setMapUnitsPerScaleBarUnit(double units)
Sets the number of map units per scale bar unit used by the scalebar.
void setHeight(double height)
Sets the scalebar height (in millimeters).
void setNumberOfSegmentsLeft(int segments)
Sets the number of segments included in the left part of the scalebar.
void setLinkedMap(QgsLayoutItemMap *map)
Sets the map item linked to the scalebar.
Q_DECL_DEPRECATED void setFontColor(const QColor &color)
Sets the color used for drawing text in the scalebar.
void setBoxContentSpace(double space)
Sets the space (margin) between the scalebar box and content in millimeters.
void setUnitLabel(const QString &label)
Sets the label for units.
void setUnitsPerSegment(double units)
Sets the number of scalebar units per segment.
Q_DECL_DEPRECATED void setFont(const QFont &font)
Sets the font used for drawing text in the scalebar.
void setSubdivisionLineSymbol(QgsLineSymbol *symbol)
Sets the line symbol used to render the scalebar subdivisions (only used for some scalebar types).
Layout item for basic filled shapes (e.g.
void setShapeType(QgsLayoutItemShape::Shape type)
Sets the type of shape (e.g.
void setSymbol(QgsFillSymbol *symbol)
Sets the fill symbol used to draw the shape.
void setCornerRadius(QgsLayoutMeasurement radius)
Sets the corner radius for rounded rectangle corners.
Base class for graphical items within a QgsLayout.
virtual void setFrameStrokeWidth(QgsLayoutMeasurement width)
Sets the frame stroke width.
QgsLayoutSize sizeWithUnits() const
Returns the item's current size, including units.
QgsLayoutItemGroup * parentGroup() const
Returns the item's parent group, if the item is part of a QgsLayoutItemGroup group.
virtual void setItemRotation(double rotation, bool adjustPosition=true)
Sets the layout item's rotation, in degrees clockwise.
QgsLayoutMeasurement frameStrokeWidth() const
Returns the frame's stroke width.
void setItemOpacity(double opacity)
Sets the item's opacity.
virtual void setVisibility(bool visible)
Sets whether the item is visible.
ReferencePoint
Fixed position reference point.
virtual void setId(const QString &id)
Set the item's id name.
void setFrameStrokeColor(const QColor &color)
Sets the frame stroke color.
void setFrameJoinStyle(Qt::PenJoinStyle style)
Sets the join style used when drawing the item's frame.
void refreshBackgroundColor(bool updateItem=true)
Refresh item's background color, considering data defined colors.
virtual void setFrameEnabled(bool drawFrame)
Sets whether this item has a frame drawn around it or not.
void setLocked(bool locked)
Sets whether the item is locked, preventing mouse interactions with the item.
void refreshFrame(bool updateItem=true)
Refresh item's frame, considering data defined colors and frame size.
virtual QString uuid() const
Returns the item identification string.
virtual void attemptMove(const QgsLayoutPoint &point, bool useReferencePoint=true, bool includesFrame=false, int page=-1)
Attempts to move the item to a specified point.
void setBlendMode(QPainter::CompositionMode mode)
Sets the item's composition blending mode.
bool frameEnabled() const
Returns true if the item includes a frame.
void attemptMoveBy(double deltaX, double deltaY)
Attempts to shift the item's position by a specified deltaX and deltaY, in layout units.
void setReferencePoint(ReferencePoint point)
Sets the reference point for positioning of the layout item.
bool hasBackground() const
Returns true if the item has a background.
void attemptSetSceneRect(const QRectF &rect, bool includesFrame=false)
Attempts to update the item's position and size to match the passed rect in layout coordinates.
QColor frameStrokeColor() const
Returns the frame's stroke color.
void setBackgroundEnabled(bool drawBackground)
Sets whether this item has a background drawn under it or not.
Qt::PenJoinStyle frameJoinStyle() const
Returns the join style used for drawing the item's frame.
This class provides a method of storing measurements for use in QGIS layouts using a variety of diffe...
double length() const
Returns the length of the measurement.
void setResizeMode(ResizeMode mode)
Sets the resize mode for the multiframe, and recalculates frame sizes to match.
virtual void addFrame(QgsLayoutFrame *frame, bool recalcFrameSizes=true)
Adds a frame to the multiframe.
ResizeMode
Specifies the behavior for creating new frames to fit the multiframe's content.
QList< QgsLayoutFrame * > frames() const
Returns a list of all child frames for this multiframe.
void setNodes(const QPolygonF &nodes)
Sets the nodes the shape consists of.
void setNorthOffset(double offset)
Sets the offset added to the arrows's rotation from a map's North.
NorthMode
Method for syncing rotation to a map's North direction.
void setNorthMode(NorthMode mode)
Sets the mode used to calculate the arrow rotation.
A base class for objects which belong to a layout.
QgsObjectCustomProperties mCustomProperties
Custom properties for object.
QgsPropertyCollection mDataDefinedProperties
const QgsLayout * layout() const
Returns the layout the object is attached to.
double spaceBetweenPages() const
Returns the space between pages, in layout units.
QList< QgsLayoutItemPage * > pages()
Returns a list of pages in the collection.
int pageCount() const
Returns the number of pages in the collection.
This class provides a method of storing points, consisting of an x and y coordinate,...
This class provides a method of storing sizes, consisting of a width and height, for use in QGIS layo...
double height() const
Returns the height of the size.
Stores properties of a column for a QgsLayoutTable.
Styling option for a layout table cell.
bool readXml(const QDomElement &styleElem)
Reads the style's properties from XML.
void setHeaderHAlignment(HeaderHAlignment alignment)
Sets the horizontal alignment for table headers.
void setShowEmptyRows(bool showEmpty)
Sets whether empty rows should be drawn.
void setVerticalGrid(bool verticalGrid)
Sets whether the grid's vertical lines should be drawn in the table.
void setGridColor(const QColor &color)
Sets the color used for grid lines in the table.
void setCellMargin(double margin)
Sets the margin distance in mm between cell borders and their contents.
void setBackgroundColor(const QColor &color)
Sets the color used for background of table.
void setContentTextFormat(const QgsTextFormat &format)
Sets the format used to draw content text in the table.
QgsTextFormat contentTextFormat() const
Returns the format used to draw content text in the table.
void setWrapBehavior(WrapBehavior behavior)
Sets the wrap behavior for the table, which controls how text within cells is automatically wrapped.
void setEmptyTableBehavior(EmptyTableMode mode)
Sets the behavior mode for empty tables with no content rows.
void setHeaderMode(HeaderMode mode)
Sets the display mode for headers in the table.
void setHorizontalGrid(bool horizontalGrid)
Sets whether the grid's horizontal lines should be drawn in the table.
HeaderMode
Controls where headers are shown in the table.
QgsLayoutTableColumns mColumns
Columns to show in table.
void setShowGrid(bool showGrid)
Sets whether grid lines should be drawn in the table.
QgsTextFormat headerTextFormat() const
Returns the format used to draw header text in the table.
void setEmptyTableMessage(const QString &message)
Sets the message for empty tables with no content rows.
void setHeaderTextFormat(const QgsTextFormat &format)
Sets the format used to draw header text in the table.
QgsLayoutTableSortColumns mSortColumns
Columns to sort the table.
void setGridStrokeWidth(double width)
Sets the width in mm for grid lines in the table.
WrapBehavior
Controls how long strings in the table are handled.
HeaderHAlignment
Controls how headers are horizontally aligned in a table.
EmptyTableMode
Controls how empty tables are displayed.
QMap< CellStyleGroup, QgsLayoutTableStyle * > mCellStyles
QgsLayoutPageCollection * pageCollection()
Returns a pointer to the layout's page collection, which stores and manages page items in the layout.
QgsLayoutItem * itemByUuid(const QString &uuid, bool includeTemplateUuids=false) const
Returns the layout item with matching uuid unique identifier, or nullptr if a matching item could not...
void addLayoutItem(QgsLayoutItem *item)
Adds an item to the layout.
QgsProject * project() const
The project associated with the layout.
Contains detailed styling information relating to how a layout legend should be rendered.
void readXml(const QDomElement &elem, const QDomDocument &doc, const QgsReadWriteContext &context=QgsReadWriteContext())
Reads the component's style definition from an XML element.
Style
Component of legends which can be styled.
@ Group
Legend group title.
@ Symbol
Symbol icon (excluding label)
@ Subgroup
Legend subgroup title.
@ SymbolLabel
Symbol label (excluding icon)
A line symbol type, for rendering LineString and MultiLineString geometries.
static QgsLineSymbol * createSimple(const QVariantMap &properties)
Create a line symbol with one symbol layer: SimpleLine with specified properties.
void setWidth(double width)
Sets the width for the whole line symbol.
Stores style information (renderer, opacity, labeling, diagrams etc.) applicable to a map layer.
void readXml(const QDomElement &styleElement)
Read style configuration (for project file reading)
QString xmlData() const
Returns XML content of the style.
void readXml(const QDomNode &parentNode, const QString &keyStartsWith=QString())
Read store contents from an XML node.
static QPainter::CompositionMode getCompositionMode(QgsPainting::BlendMode blendMode)
Returns a QPainter::CompositionMode corresponding to a BlendMode.
BlendMode
Blending modes enum defining the available composition modes that can be used when rendering a layer.
Resolves relative paths into absolute paths and vice versa.
QString readPath(const QString &filename) const
Turn filename read from the project file to an absolute path.
Print layout, a QgsLayout subclass for static or atlas-based layouts.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
QgsPathResolver pathResolver() const
Returns path resolver object with considering whether the project uses absolute or relative paths and...
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
QgsProperty property(int key) const override
Returns a matching property from the collection, if one exists.
void setProperty(int key, const QgsProperty &property)
Adds a property to the collection and takes ownership of it.
bool isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
Definition for a property.
@ Double
Double value (including negative values)
@ StrokeWidth
Line stroke width.
@ String
Any string value.
@ IntegerPositiveGreaterZero
Non-zero positive integer values.
@ IntegerPositive
Positive integer values (including 0)
@ Rotation
Rotation (value between 0-360 degrees)
@ ColorWithAlpha
Color with alpha channel.
@ DoublePositive
Positive double value (including 0)
@ DataTypeString
Property requires a string value.
A store for object properties.
QString asExpression() const
Returns an expression string representing the state of the property, or an empty string if the proper...
static QgsProperty fromExpression(const QString &expression, bool isActive=true)
Returns a new ExpressionBasedProperty created from the specified expression.
static QgsProperty fromField(const QString &fieldName, bool isActive=true)
Returns a new FieldBasedProperty created from the specified field name.
The class is used as a container of context for various read/write operations on other objects.
void setProjectTranslator(QgsProjectTranslator *projectTranslator)
Sets the project translator.
void setPathResolver(const QgsPathResolver &resolver)
Sets up path resolver for conversion between relative and absolute paths.
A rectangle specified with double values.
Alignment
Scalebar alignment.
SegmentSizeMode
Modes for setting size for scale bar segments.
static Qt::PenJoinStyle decodePenJoinStyle(const QString &str)
static QColor decodeColor(const QString &str)
static Qt::PenCapStyle decodePenCapStyle(const QString &str)
static QString svgSymbolNameToPath(const QString &name, const QgsPathResolver &pathResolver)
Determines an SVG symbol's path from its name.
static QString encodeColor(const QColor &color)
void setColor(const QColor &color)
Sets the color for the symbol.
Container for all settings relating to text rendering.
void setColor(const QColor &color)
Sets the color that text will be rendered in.
void setSize(double size)
Sets the size for rendered text.
void setFont(const QFont &font)
Sets the font used for rendering text.
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the size of rendered text.
DistanceUnit
Units of distance.
@ DistanceUnknownUnit
Unknown distance unit.
@ DistanceFeet
Imperial feet.
@ DistanceNauticalMiles
Nautical miles.
static Q_INVOKABLE QgsUnitTypes::DistanceUnit decodeDistanceUnit(const QString &string, bool *ok=nullptr)
Decodes a distance unit from a string.
@ RenderPoints
Points (e.g., for font sizes)
@ RenderMillimeters
Millimeters.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
QMap< QString, QString > QgsStringMap
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.