|
@@ -72,39 +72,6 @@ QgsLayoutSize QgsLayoutFrame::fixedSize() const |
|
|
return QgsLayoutSize( mMultiFrame->fixedFrameSize( frameIndex ), QgsUnitTypes::LayoutMillimeters ); |
|
|
} |
|
|
|
|
|
#if 0// TODO - save/restore multiframe uuid! |
|
|
bool QgsLayoutFrame::writeXml( QDomElement &elem, QDomDocument &doc ) const |
|
|
{ |
|
|
QDomElement frameElem = doc.createElement( QStringLiteral( "ComposerFrame" ) ); |
|
|
frameElem.setAttribute( QStringLiteral( "sectionX" ), QString::number( mSection.x() ) ); |
|
|
frameElem.setAttribute( QStringLiteral( "sectionY" ), QString::number( mSection.y() ) ); |
|
|
frameElem.setAttribute( QStringLiteral( "sectionWidth" ), QString::number( mSection.width() ) ); |
|
|
frameElem.setAttribute( QStringLiteral( "sectionHeight" ), QString::number( mSection.height() ) ); |
|
|
frameElem.setAttribute( QStringLiteral( "hidePageIfEmpty" ), mHidePageIfEmpty ); |
|
|
frameElem.setAttribute( QStringLiteral( "hideBackgroundIfEmpty" ), mHideBackgroundIfEmpty ); |
|
|
elem.appendChild( frameElem ); |
|
|
|
|
|
return _writeXml( frameElem, doc ); |
|
|
} |
|
|
|
|
|
bool QgsLayoutFrame::readXml( const QDomElement &itemElem, const QDomDocument &doc ) |
|
|
{ |
|
|
double x = itemElem.attribute( QStringLiteral( "sectionX" ) ).toDouble(); |
|
|
double y = itemElem.attribute( QStringLiteral( "sectionY" ) ).toDouble(); |
|
|
double width = itemElem.attribute( QStringLiteral( "sectionWidth" ) ).toDouble(); |
|
|
double height = itemElem.attribute( QStringLiteral( "sectionHeight" ) ).toDouble(); |
|
|
mSection = QRectF( x, y, width, height ); |
|
|
mHidePageIfEmpty = itemElem.attribute( QStringLiteral( "hidePageIfEmpty" ), QStringLiteral( "0" ) ).toInt(); |
|
|
mHideBackgroundIfEmpty = itemElem.attribute( QStringLiteral( "hideBackgroundIfEmpty" ), QStringLiteral( "0" ) ).toInt(); |
|
|
QDomElement composerItem = itemElem.firstChildElement( QStringLiteral( "ComposerItem" ) ); |
|
|
if ( composerItem.isNull() ) |
|
|
{ |
|
|
return false; |
|
|
} |
|
|
return _readXml( composerItem, doc ); |
|
|
} |
|
|
#endif |
|
|
|
|
|
int QgsLayoutFrame::type() const |
|
|
{ |
|
|
return QgsLayoutItemRegistry::LayoutFrame; |
|
@@ -118,14 +85,6 @@ QIcon QgsLayoutFrame::icon() const |
|
|
return QIcon(); |
|
|
} |
|
|
|
|
|
QString QgsLayoutFrame::uuid() const |
|
|
{ |
|
|
if ( mMultiFrame ) |
|
|
return mMultiFrame->uuid() + ':' + mMultiFrame->frameIndex( const_cast< QgsLayoutFrame * >( this ) ); |
|
|
else |
|
|
return QgsLayoutItem::uuid(); |
|
|
} |
|
|
|
|
|
void QgsLayoutFrame::setHidePageIfEmpty( const bool hidePageIfEmpty ) |
|
|
{ |
|
|
mHidePageIfEmpty = hidePageIfEmpty; |
|
@@ -168,10 +127,8 @@ QgsExpressionContext QgsLayoutFrame::createExpressionContext() const |
|
|
//start with multiframe's context |
|
|
QgsExpressionContext context = mMultiFrame->createExpressionContext(); |
|
|
|
|
|
#if 0 //TODO |
|
|
//add frame's individual context |
|
|
context.appendScope( QgsExpressionContextUtils::layoutItemScope( this ) ); |
|
|
#endif |
|
|
|
|
|
return context; |
|
|
} |
|
@@ -226,6 +183,33 @@ void QgsLayoutFrame::drawBackground( QgsRenderContext &context ) |
|
|
} |
|
|
} |
|
|
|
|
|
bool QgsLayoutFrame::writePropertiesToElement( QDomElement &parentElement, QDomDocument &, const QgsReadWriteContext & ) const |
|
|
{ |
|
|
parentElement.setAttribute( QStringLiteral( "multiFrame" ), mMultiFrameUuid ); |
|
|
parentElement.setAttribute( QStringLiteral( "sectionX" ), QString::number( mSection.x() ) ); |
|
|
parentElement.setAttribute( QStringLiteral( "sectionY" ), QString::number( mSection.y() ) ); |
|
|
parentElement.setAttribute( QStringLiteral( "sectionWidth" ), QString::number( mSection.width() ) ); |
|
|
parentElement.setAttribute( QStringLiteral( "sectionHeight" ), QString::number( mSection.height() ) ); |
|
|
parentElement.setAttribute( QStringLiteral( "hidePageIfEmpty" ), mHidePageIfEmpty ); |
|
|
parentElement.setAttribute( QStringLiteral( "hideBackgroundIfEmpty" ), mHideBackgroundIfEmpty ); |
|
|
return true; |
|
|
} |
|
|
|
|
|
bool QgsLayoutFrame::readPropertiesFromElement( const QDomElement &itemElem, const QDomDocument &, const QgsReadWriteContext & ) |
|
|
{ |
|
|
double x = itemElem.attribute( QStringLiteral( "sectionX" ) ).toDouble(); |
|
|
double y = itemElem.attribute( QStringLiteral( "sectionY" ) ).toDouble(); |
|
|
double width = itemElem.attribute( QStringLiteral( "sectionWidth" ) ).toDouble(); |
|
|
double height = itemElem.attribute( QStringLiteral( "sectionHeight" ) ).toDouble(); |
|
|
mSection = QRectF( x, y, width, height ); |
|
|
mHidePageIfEmpty = itemElem.attribute( QStringLiteral( "hidePageIfEmpty" ), QStringLiteral( "0" ) ).toInt(); |
|
|
mHideBackgroundIfEmpty = itemElem.attribute( QStringLiteral( "hideBackgroundIfEmpty" ), QStringLiteral( "0" ) ).toInt(); |
|
|
|
|
|
mMultiFrameUuid = itemElem.attribute( QStringLiteral( "multiFrame" ) ); |
|
|
mMultiFrame = mLayout->multiFrameByUuid( mMultiFrameUuid ); |
|
|
return true; |
|
|
} |
|
|
|
|
|
#if 0 //TODO |
|
|
void QgsLayoutFrame::beginItemCommand( const QString &text ) |
|
|
{ |
|
|