mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Fix layout designer does not respect layout settings
This commit is contained in:
parent
279785302d
commit
343c070adf
@ -332,6 +332,11 @@ Stores the section state in a DOM element.
|
||||
Sets the item state from a DOM element.
|
||||
|
||||
.. seealso:: :py:func:`writeXml`
|
||||
%End
|
||||
|
||||
virtual void reloadSettings();
|
||||
%Docstring
|
||||
Refreshes the section when global layout related options change.
|
||||
%End
|
||||
|
||||
protected:
|
||||
|
@ -330,6 +330,11 @@ to grid appearance, spacing and offsets.
|
||||
%End
|
||||
|
||||
|
||||
void reloadSettings();
|
||||
%Docstring
|
||||
Refreshes the layout when global layout related options change.
|
||||
%End
|
||||
|
||||
QgsLayoutGuideCollection &guides();
|
||||
%Docstring
|
||||
Returns a reference to the layout's guide collection, which manages page snap guides.
|
||||
|
@ -107,6 +107,11 @@ Returns the style used for drawing the page/snap grids.
|
||||
.. seealso:: :py:func:`setStyle`
|
||||
|
||||
.. seealso:: :py:func:`pen`
|
||||
%End
|
||||
|
||||
void loadFromSettings();
|
||||
%Docstring
|
||||
Loads grid settings from the application layout settings.
|
||||
%End
|
||||
|
||||
virtual bool writeXml( QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context ) const;
|
||||
|
@ -99,6 +99,10 @@ Sets the layout's state from a DOM element. ``layoutElement`` is the DOM node co
|
||||
.. seealso:: :py:func:`writeLayoutXml`
|
||||
%End
|
||||
|
||||
virtual void updateSettings() = 0;
|
||||
%Docstring
|
||||
Refreshes the layout when global layout related options change.
|
||||
%End
|
||||
};
|
||||
|
||||
|
||||
|
@ -55,6 +55,8 @@ Returns the print layout's atlas.
|
||||
|
||||
virtual QgsExpressionContext createExpressionContext() const;
|
||||
|
||||
virtual void updateSettings();
|
||||
|
||||
|
||||
signals:
|
||||
|
||||
|
@ -54,6 +54,8 @@ Note that ownership is not transferred to ``project``.
|
||||
|
||||
virtual bool readLayoutXml( const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context );
|
||||
|
||||
virtual void updateSettings();
|
||||
|
||||
|
||||
signals:
|
||||
|
||||
|
@ -142,6 +142,8 @@ ascending, or false for descending sort.
|
||||
|
||||
virtual void setParentSection( QgsAbstractReportSection *parentSection );
|
||||
|
||||
virtual void reloadSettings();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -89,6 +89,8 @@ Sets whether the body for the section is ``enabled``.
|
||||
|
||||
virtual QgsLayout *nextBody( bool &ok );
|
||||
|
||||
virtual void reloadSettings();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -234,6 +234,11 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla
|
||||
|
||||
connect( mActionPageSetup, &QAction::triggered, this, &QgsLayoutDesignerDialog::pageSetup );
|
||||
|
||||
connect( mActionOptions, &QAction::triggered, this, [ = ]
|
||||
{
|
||||
QgisApp::instance()->showOptionsDialog( this, QString( "mOptionsPageComposer" ) );
|
||||
} );
|
||||
|
||||
mView = new QgsLayoutView();
|
||||
//mView->setMapCanvas( mQgis->mapCanvas() );
|
||||
mView->setContentsMargins( 0, 0, 0, 0 );
|
||||
|
@ -9707,9 +9707,10 @@ void QgisApp::showOptionsDialog( QWidget *parent, const QString ¤tPage )
|
||||
//update any open compositions so they reflect new composer settings
|
||||
//we have to push the changes to the compositions here, because compositions
|
||||
//have no access to qgisapp and accordingly can't listen in to changes
|
||||
Q_FOREACH ( QgsComposition *c, QgsProject::instance()->layoutManager()->compositions() )
|
||||
const QList< QgsMasterLayoutInterface * > layouts = QgsProject::instance()->layoutManager()->layouts() ;
|
||||
for ( QgsMasterLayoutInterface *layout : layouts )
|
||||
{
|
||||
c->updateSettings();
|
||||
layout->updateSettings();
|
||||
}
|
||||
|
||||
//do we need this? TS
|
||||
|
@ -767,30 +767,29 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
|
||||
}
|
||||
|
||||
//
|
||||
// Composer settings
|
||||
// Layout settings
|
||||
//
|
||||
|
||||
//default composer font
|
||||
//default layout font
|
||||
mComposerFontComboBox->blockSignals( true );
|
||||
|
||||
QString composerFontFamily = mSettings->value( QStringLiteral( "/Composer/defaultFont" ) ).toString();
|
||||
QString layoutFontFamily = mSettings->value( QStringLiteral( "LayoutDesigner/defaultFont" ), QVariant(), QgsSettings::Gui ).toString();
|
||||
|
||||
QFont *tempComposerFont = new QFont( composerFontFamily );
|
||||
QFont tempLayoutFont( layoutFontFamily );
|
||||
// is exact family match returned from system?
|
||||
if ( tempComposerFont->family() == composerFontFamily )
|
||||
if ( tempLayoutFont.family() == layoutFontFamily )
|
||||
{
|
||||
mComposerFontComboBox->setCurrentFont( *tempComposerFont );
|
||||
mComposerFontComboBox->setCurrentFont( tempLayoutFont );
|
||||
}
|
||||
delete tempComposerFont;
|
||||
|
||||
mComposerFontComboBox->blockSignals( false );
|
||||
|
||||
//default composer grid color
|
||||
//default layout grid color
|
||||
int gridRed, gridGreen, gridBlue, gridAlpha;
|
||||
gridRed = mSettings->value( QStringLiteral( "/Composer/gridRed" ), 190 ).toInt();
|
||||
gridGreen = mSettings->value( QStringLiteral( "/Composer/gridGreen" ), 190 ).toInt();
|
||||
gridBlue = mSettings->value( QStringLiteral( "/Composer/gridBlue" ), 190 ).toInt();
|
||||
gridAlpha = mSettings->value( QStringLiteral( "/Composer/gridAlpha" ), 100 ).toInt();
|
||||
gridRed = mSettings->value( QStringLiteral( "LayoutDesigner/gridRed" ), 190, QgsSettings::Gui ).toInt();
|
||||
gridGreen = mSettings->value( QStringLiteral( "LayoutDesigner/gridGreen" ), 190, QgsSettings::Gui ).toInt();
|
||||
gridBlue = mSettings->value( QStringLiteral( "LayoutDesigner/gridBlue" ), 190, QgsSettings::Gui ).toInt();
|
||||
gridAlpha = mSettings->value( QStringLiteral( "LayoutDesigner/gridAlpha" ), 100, QgsSettings::Gui ).toInt();
|
||||
QColor gridColor = QColor( gridRed, gridGreen, gridBlue, gridAlpha );
|
||||
mGridColorButton->setColor( gridColor );
|
||||
mGridColorButton->setColorDialogTitle( tr( "Select Grid Color" ) );
|
||||
@ -798,9 +797,9 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
|
||||
mGridColorButton->setContext( QStringLiteral( "gui" ) );
|
||||
mGridColorButton->setDefaultColor( QColor( 190, 190, 190, 100 ) );
|
||||
|
||||
//default composer grid style
|
||||
//default layout grid style
|
||||
QString gridStyleString;
|
||||
gridStyleString = mSettings->value( QStringLiteral( "/Composer/gridStyle" ), "Dots" ).toString();
|
||||
gridStyleString = mSettings->value( QStringLiteral( "LayoutDesigner/gridStyle" ), "Dots", QgsSettings::Gui ).toString();
|
||||
mGridStyleComboBox->insertItem( 0, tr( "Solid" ) );
|
||||
mGridStyleComboBox->insertItem( 1, tr( "Dots" ) );
|
||||
mGridStyleComboBox->insertItem( 2, tr( "Crosses" ) );
|
||||
@ -819,10 +818,10 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
|
||||
}
|
||||
|
||||
//grid and guide defaults
|
||||
mGridResolutionSpinBox->setValue( mSettings->value( QStringLiteral( "/Composer/defaultSnapGridResolution" ), 10.0 ).toDouble() );
|
||||
mSnapToleranceSpinBox->setValue( mSettings->value( QStringLiteral( "/Composer/defaultSnapTolerancePixels" ), 5 ).toInt() );
|
||||
mOffsetXSpinBox->setValue( mSettings->value( QStringLiteral( "/Composer/defaultSnapGridOffsetX" ), 0 ).toDouble() );
|
||||
mOffsetYSpinBox->setValue( mSettings->value( QStringLiteral( "/Composer/defaultSnapGridOffsetY" ), 0 ).toDouble() );
|
||||
mGridResolutionSpinBox->setValue( mSettings->value( QStringLiteral( "LayoutDesigner/defaultSnapGridResolution" ), 10.0, QgsSettings::Gui ).toDouble() );
|
||||
mSnapToleranceSpinBox->setValue( mSettings->value( QStringLiteral( "LayoutDesigner/defaultSnapTolerancePixels" ), 5, QgsSettings::Gui ).toInt() );
|
||||
mOffsetXSpinBox->setValue( mSettings->value( QStringLiteral( "LayoutDesigner/defaultSnapGridOffsetX" ), 0, QgsSettings::Gui ).toDouble() );
|
||||
mOffsetYSpinBox->setValue( mSettings->value( QStringLiteral( "LayoutDesigner/defaultSnapGridOffsetY" ), 0, QgsSettings::Gui ).toDouble() );
|
||||
|
||||
//
|
||||
// Locale settings
|
||||
@ -1457,38 +1456,38 @@ void QgsOptions::saveOptions()
|
||||
}
|
||||
|
||||
//
|
||||
// Composer settings
|
||||
// Layout settings
|
||||
//
|
||||
|
||||
//default font
|
||||
QString composerFont = mComposerFontComboBox->currentFont().family();
|
||||
mSettings->setValue( QStringLiteral( "/Composer/defaultFont" ), composerFont );
|
||||
QString layoutFont = mComposerFontComboBox->currentFont().family();
|
||||
mSettings->setValue( QStringLiteral( "LayoutDesigner/defaultFont" ), layoutFont, QgsSettings::Gui );
|
||||
|
||||
//grid color
|
||||
mSettings->setValue( QStringLiteral( "/Composer/gridRed" ), mGridColorButton->color().red() );
|
||||
mSettings->setValue( QStringLiteral( "/Composer/gridGreen" ), mGridColorButton->color().green() );
|
||||
mSettings->setValue( QStringLiteral( "/Composer/gridBlue" ), mGridColorButton->color().blue() );
|
||||
mSettings->setValue( QStringLiteral( "/Composer/gridAlpha" ), mGridColorButton->color().alpha() );
|
||||
mSettings->setValue( QStringLiteral( "LayoutDesigner/gridRed" ), mGridColorButton->color().red(), QgsSettings::Gui );
|
||||
mSettings->setValue( QStringLiteral( "LayoutDesigner/gridGreen" ), mGridColorButton->color().green(), QgsSettings::Gui );
|
||||
mSettings->setValue( QStringLiteral( "LayoutDesigner/gridBlue" ), mGridColorButton->color().blue(), QgsSettings::Gui );
|
||||
mSettings->setValue( QStringLiteral( "LayoutDesigner/gridAlpha" ), mGridColorButton->color().alpha(), QgsSettings::Gui );
|
||||
|
||||
//grid style
|
||||
if ( mGridStyleComboBox->currentText() == tr( "Solid" ) )
|
||||
{
|
||||
mSettings->setValue( QStringLiteral( "/Composer/gridStyle" ), "Solid" );
|
||||
mSettings->setValue( QStringLiteral( "LayoutDesigner/gridStyle" ), "Solid", QgsSettings::Gui );
|
||||
}
|
||||
else if ( mGridStyleComboBox->currentText() == tr( "Dots" ) )
|
||||
{
|
||||
mSettings->setValue( QStringLiteral( "/Composer/gridStyle" ), "Dots" );
|
||||
mSettings->setValue( QStringLiteral( "LayoutDesigner/gridStyle" ), "Dots", QgsSettings::Gui );
|
||||
}
|
||||
else if ( mGridStyleComboBox->currentText() == tr( "Crosses" ) )
|
||||
{
|
||||
mSettings->setValue( QStringLiteral( "/Composer/gridStyle" ), "Crosses" );
|
||||
mSettings->setValue( QStringLiteral( "LayoutDesigner/gridStyle" ), "Crosses", QgsSettings::Gui );
|
||||
}
|
||||
|
||||
//grid and guide defaults
|
||||
mSettings->setValue( QStringLiteral( "/Composer/defaultSnapGridResolution" ), mGridResolutionSpinBox->value() );
|
||||
mSettings->setValue( QStringLiteral( "/Composer/defaultSnapTolerancePixels" ), mSnapToleranceSpinBox->value() );
|
||||
mSettings->setValue( QStringLiteral( "/Composer/defaultSnapGridOffsetX" ), mOffsetXSpinBox->value() );
|
||||
mSettings->setValue( QStringLiteral( "/Composer/defaultSnapGridOffsetY" ), mOffsetYSpinBox->value() );
|
||||
mSettings->setValue( QStringLiteral( "LayoutDesigner/defaultSnapGridResolution" ), mGridResolutionSpinBox->value(), QgsSettings::Gui );
|
||||
mSettings->setValue( QStringLiteral( "LayoutDesigner/defaultSnapTolerancePixels" ), mSnapToleranceSpinBox->value(), QgsSettings::Gui );
|
||||
mSettings->setValue( QStringLiteral( "LayoutDesigner/defaultSnapGridOffsetX" ), mOffsetXSpinBox->value(), QgsSettings::Gui );
|
||||
mSettings->setValue( QStringLiteral( "LayoutDesigner/defaultSnapGridOffsetY" ), mOffsetYSpinBox->value(), QgsSettings::Gui );
|
||||
|
||||
//
|
||||
// Locale settings
|
||||
|
@ -164,6 +164,14 @@ bool QgsAbstractReportSection::readXml( const QDomElement &element, const QDomDo
|
||||
return result;
|
||||
}
|
||||
|
||||
void QgsAbstractReportSection::reloadSettings()
|
||||
{
|
||||
if ( mHeader )
|
||||
mHeader->reloadSettings();
|
||||
if ( mFooter )
|
||||
mFooter->reloadSettings();
|
||||
}
|
||||
|
||||
QString QgsAbstractReportSection::filePath( const QString &baseFilePath, const QString &extension )
|
||||
{
|
||||
QString base = QStringLiteral( "%1_%2" ).arg( baseFilePath ).arg( mSectionNumber, 4, 10, QChar( '0' ) );
|
||||
|
@ -303,6 +303,11 @@ class CORE_EXPORT QgsAbstractReportSection : public QgsAbstractLayoutIterator
|
||||
*/
|
||||
bool readXml( const QDomElement §ionElement, const QDomDocument &document, const QgsReadWriteContext &context );
|
||||
|
||||
/**
|
||||
* Refreshes the section when global layout related options change.
|
||||
*/
|
||||
virtual void reloadSettings();
|
||||
|
||||
protected:
|
||||
|
||||
//! Report sub-sections
|
||||
|
@ -358,6 +358,12 @@ const QgsLayoutReportContext &QgsLayout::reportContext() const
|
||||
return *mReportContext;
|
||||
}
|
||||
|
||||
void QgsLayout::reloadSettings()
|
||||
{
|
||||
mGridSettings.loadFromSettings();
|
||||
mPageCollection->redraw();
|
||||
}
|
||||
|
||||
QgsLayoutGuideCollection &QgsLayout::guides()
|
||||
{
|
||||
return mPageCollection->guides();
|
||||
|
@ -393,6 +393,11 @@ class CORE_EXPORT QgsLayout : public QGraphicsScene, public QgsExpressionContext
|
||||
*/
|
||||
SIP_SKIP const QgsLayoutGridSettings &gridSettings() const { return mGridSettings; }
|
||||
|
||||
/**
|
||||
* Refreshes the layout when global layout related options change.
|
||||
*/
|
||||
void reloadSettings();
|
||||
|
||||
/**
|
||||
* Returns a reference to the layout's guide collection, which manages page snap guides.
|
||||
*/
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "qgsproject.h"
|
||||
#include "qgslayoutundostack.h"
|
||||
#include "qgslayoutpagecollection.h"
|
||||
#include "qgssettings.h"
|
||||
|
||||
QgsLayoutGridSettings::QgsLayoutGridSettings( QgsLayout *layout )
|
||||
: mGridResolution( QgsLayoutMeasurement( 10 ) )
|
||||
@ -27,6 +28,7 @@ QgsLayoutGridSettings::QgsLayoutGridSettings( QgsLayout *layout )
|
||||
{
|
||||
mGridPen = QPen( QColor( 190, 190, 190, 100 ), 0 );
|
||||
mGridPen.setCosmetic( true );
|
||||
loadFromSettings();
|
||||
}
|
||||
|
||||
QgsLayout *QgsLayoutGridSettings::layout()
|
||||
@ -48,6 +50,44 @@ void QgsLayoutGridSettings::setOffset( const QgsLayoutPoint offset )
|
||||
mLayout->undoStack()->endCommand();
|
||||
}
|
||||
|
||||
void QgsLayoutGridSettings::loadFromSettings()
|
||||
{
|
||||
//read grid style, grid color and pen width from settings
|
||||
QgsSettings s;
|
||||
|
||||
QString gridStyleString;
|
||||
gridStyleString = s.value( QStringLiteral( "LayoutDesigner/gridStyle" ), "Dots", QgsSettings::Gui ).toString();
|
||||
|
||||
int gridRed, gridGreen, gridBlue, gridAlpha;
|
||||
gridRed = s.value( QStringLiteral( "LayoutDesigner/gridRed" ), 190, QgsSettings::Gui ).toInt();
|
||||
gridGreen = s.value( QStringLiteral( "LayoutDesigner/gridGreen" ), 190, QgsSettings::Gui ).toInt();
|
||||
gridBlue = s.value( QStringLiteral( "LayoutDesigner/gridBlue" ), 190, QgsSettings::Gui ).toInt();
|
||||
gridAlpha = s.value( QStringLiteral( "LayoutDesigner/gridAlpha" ), 100, QgsSettings::Gui ).toInt();
|
||||
QColor gridColor = QColor( gridRed, gridGreen, gridBlue, gridAlpha );
|
||||
|
||||
mGridPen.setColor( gridColor );
|
||||
mGridPen.setWidthF( 0 );
|
||||
mGridPen.setCosmetic( true );
|
||||
|
||||
if ( gridStyleString == QLatin1String( "Dots" ) )
|
||||
{
|
||||
mGridStyle = StyleDots;
|
||||
}
|
||||
else if ( gridStyleString == QLatin1String( "Crosses" ) )
|
||||
{
|
||||
mGridStyle = StyleCrosses;
|
||||
}
|
||||
else
|
||||
{
|
||||
mGridStyle = StyleLines;
|
||||
}
|
||||
|
||||
mGridResolution = QgsLayoutMeasurement( s.value( QStringLiteral( "LayoutDesigner/defaultSnapGridResolution" ), 10.0, QgsSettings::Gui ).toDouble(), QgsUnitTypes::LayoutMillimeters );
|
||||
// mSnapToleranceSpinBox->setValue( mSettings->value( QStringLiteral( "LayoutDesigner/defaultSnapTolerancePixels" ), 5, QgsSettings::Gui ).toInt() );
|
||||
mGridOffset = QgsLayoutPoint( s.value( QStringLiteral( "LayoutDesigner/defaultSnapGridOffsetX" ), 0, QgsSettings::Gui ).toDouble(),
|
||||
s.value( QStringLiteral( "LayoutDesigner/defaultSnapGridOffsetY" ), 0, QgsSettings::Gui ).toDouble(), QgsUnitTypes::LayoutMillimeters );
|
||||
}
|
||||
|
||||
bool QgsLayoutGridSettings::writeXml( QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext & ) const
|
||||
{
|
||||
QDomElement element = document.createElement( QStringLiteral( "Grid" ) );
|
||||
|
@ -109,6 +109,11 @@ class CORE_EXPORT QgsLayoutGridSettings : public QgsLayoutSerializableObject
|
||||
*/
|
||||
Style style() const { return mGridStyle; }
|
||||
|
||||
/**
|
||||
* Loads grid settings from the application layout settings.
|
||||
*/
|
||||
void loadFromSettings();
|
||||
|
||||
/**
|
||||
* Stores the grid's state in a DOM element. The \a parentElement should refer to the parent layout's DOM element.
|
||||
* \see readXml()
|
||||
|
@ -51,7 +51,7 @@ QgsLayoutItemLabel::QgsLayoutItemLabel( QgsLayout *layout )
|
||||
|
||||
//get default composer font from settings
|
||||
QgsSettings settings;
|
||||
QString defaultFontString = settings.value( QStringLiteral( "Composer/defaultFont" ) ).toString();
|
||||
QString defaultFontString = settings.value( QStringLiteral( "LayoutDesigner/defaultFont" ), QVariant(), QgsSettings::Gui ).toString();
|
||||
if ( !defaultFontString.isEmpty() )
|
||||
{
|
||||
mFont.setFamily( defaultFontString );
|
||||
|
@ -162,7 +162,7 @@ QgsLayoutItemMapGrid::QgsLayoutItemMapGrid( const QString &name, QgsLayoutItemMa
|
||||
{
|
||||
//get default layout font from settings
|
||||
QgsSettings settings;
|
||||
QString defaultFontString = settings.value( QStringLiteral( "Composer/defaultFont" ) ).toString();
|
||||
QString defaultFontString = settings.value( QStringLiteral( "LayoutDesigner/defaultFont" ), QVariant(), QgsSettings::Gui ).toString();
|
||||
if ( !defaultFontString.isEmpty() )
|
||||
{
|
||||
mGridAnnotationFont.setFamily( defaultFontString );
|
||||
|
@ -375,7 +375,7 @@ void QgsLayoutItemScaleBar::applyDefaultSettings()
|
||||
|
||||
//get default composer font from settings
|
||||
QgsSettings settings;
|
||||
QString defaultFontString = settings.value( QStringLiteral( "Composer/defaultFont" ) ).toString();
|
||||
QString defaultFontString = settings.value( QStringLiteral( "LayoutDesigner/defaultFont" ), QVariant(), QgsSettings::Gui ).toString();
|
||||
QFont f;
|
||||
if ( !defaultFontString.isEmpty() )
|
||||
{
|
||||
|
@ -19,10 +19,13 @@
|
||||
#include "qgsreadwritecontext.h"
|
||||
#include "qgsproject.h"
|
||||
#include "qgslayoutpagecollection.h"
|
||||
#include "qgssettings.h"
|
||||
|
||||
QgsLayoutSnapper::QgsLayoutSnapper( QgsLayout *layout )
|
||||
: mLayout( layout )
|
||||
{
|
||||
QgsSettings s;
|
||||
mTolerance = s.value( QStringLiteral( "LayoutDesigner/defaultSnapTolerancePixels" ), 5, QgsSettings::Gui ).toInt();
|
||||
}
|
||||
|
||||
QgsLayout *QgsLayoutSnapper::layout()
|
||||
|
@ -54,7 +54,7 @@ QgsLayoutTable::QgsLayoutTable( QgsLayout *layout )
|
||||
{
|
||||
//get default composer font from settings
|
||||
QgsSettings settings;
|
||||
QString defaultFontString = settings.value( QStringLiteral( "Composer/defaultFont" ) ).toString();
|
||||
QString defaultFontString = settings.value( QStringLiteral( "LayoutDesigner/defaultFont" ), QVariant(), QgsSettings::Gui ).toString();
|
||||
if ( !defaultFontString.isEmpty() )
|
||||
{
|
||||
mHeaderFont.setFamily( defaultFontString );
|
||||
|
@ -116,6 +116,10 @@ class CORE_EXPORT QgsMasterLayoutInterface
|
||||
*/
|
||||
virtual bool readLayoutXml( const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context ) = 0;
|
||||
|
||||
/**
|
||||
* Refreshes the layout when global layout related options change.
|
||||
*/
|
||||
virtual void updateSettings() = 0;
|
||||
};
|
||||
|
||||
#endif //QGSLAYOUTINTERFACE_H
|
||||
|
@ -107,6 +107,11 @@ QgsExpressionContext QgsPrintLayout::createExpressionContext() const
|
||||
return context;
|
||||
}
|
||||
|
||||
void QgsPrintLayout::updateSettings()
|
||||
{
|
||||
reloadSettings();
|
||||
}
|
||||
|
||||
QgsMasterLayoutInterface::Type QgsPrintLayout::layoutType() const
|
||||
{
|
||||
return QgsMasterLayoutInterface::PrintLayout;
|
||||
|
@ -59,6 +59,7 @@ class CORE_EXPORT QgsPrintLayout : public QgsLayout, public QgsMasterLayoutInter
|
||||
QDomElement writeLayoutXml( QDomDocument &document, const QgsReadWriteContext &context ) const override;
|
||||
bool readLayoutXml( const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context ) override;
|
||||
QgsExpressionContext createExpressionContext() const override;
|
||||
void updateSettings() override;
|
||||
|
||||
signals:
|
||||
|
||||
|
@ -61,6 +61,11 @@ bool QgsReport::readLayoutXml( const QDomElement &layoutElement, const QDomDocum
|
||||
return true;
|
||||
}
|
||||
|
||||
void QgsReport::updateSettings()
|
||||
{
|
||||
reloadSettings();
|
||||
}
|
||||
|
||||
QgsMasterLayoutInterface::Type QgsReport::layoutType() const
|
||||
{
|
||||
return QgsMasterLayoutInterface::Report;
|
||||
|
@ -62,6 +62,7 @@ class CORE_EXPORT QgsReport : public QObject, public QgsAbstractReportSection, p
|
||||
void setName( const QString &name ) override;
|
||||
QDomElement writeLayoutXml( QDomDocument &document, const QgsReadWriteContext &context ) const override;
|
||||
bool readLayoutXml( const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context ) override;
|
||||
void updateSettings() override;
|
||||
|
||||
signals:
|
||||
|
||||
|
@ -162,6 +162,13 @@ void QgsReportSectionFieldGroup::setParentSection( QgsAbstractReportSection *par
|
||||
mCoverageLayer.resolveWeakly( project() );
|
||||
}
|
||||
|
||||
void QgsReportSectionFieldGroup::reloadSettings()
|
||||
{
|
||||
QgsAbstractReportSection::reloadSettings();
|
||||
if ( mBody )
|
||||
mBody->reloadSettings();
|
||||
}
|
||||
|
||||
bool QgsReportSectionFieldGroup::writePropertiesToElement( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context ) const
|
||||
{
|
||||
element.setAttribute( QStringLiteral( "field" ), mField );
|
||||
|
@ -127,6 +127,7 @@ class CORE_EXPORT QgsReportSectionFieldGroup : public QgsAbstractReportSection
|
||||
QgsLayout *nextBody( bool &ok ) override;
|
||||
void reset() override;
|
||||
void setParentSection( QgsAbstractReportSection *parentSection ) override;
|
||||
void reloadSettings() override;
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -66,6 +66,13 @@ QgsLayout *QgsReportSectionLayout::nextBody( bool &ok )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsReportSectionLayout::reloadSettings()
|
||||
{
|
||||
QgsAbstractReportSection::reloadSettings();
|
||||
if ( mBody )
|
||||
mBody->reloadSettings();
|
||||
}
|
||||
|
||||
bool QgsReportSectionLayout::writePropertiesToElement( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context ) const
|
||||
{
|
||||
if ( mBody )
|
||||
|
@ -81,6 +81,7 @@ class CORE_EXPORT QgsReportSectionLayout : public QgsAbstractReportSection
|
||||
QgsReportSectionLayout *clone() const override SIP_FACTORY;
|
||||
bool beginRender() override;
|
||||
QgsLayout *nextBody( bool &ok ) override;
|
||||
void reloadSettings() override;
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -31,7 +31,7 @@ QgsLegendStyle::QgsLegendStyle()
|
||||
{
|
||||
//get default composer font from settings
|
||||
QgsSettings settings;
|
||||
QString defaultFontString = settings.value( QStringLiteral( "Composer/defaultFont" ) ).toString();
|
||||
QString defaultFontString = settings.value( QStringLiteral( "LayoutDesigner/defaultFont" ), QVariant(), QgsSettings::Gui ).toString();
|
||||
if ( !defaultFontString.isEmpty() )
|
||||
{
|
||||
mFont.setFamily( defaultFontString );
|
||||
|
@ -99,7 +99,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>2180</width>
|
||||
<height>25</height>
|
||||
<height>42</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="mLayoutMenu">
|
||||
@ -289,6 +289,12 @@
|
||||
<addaction name="separator"/>
|
||||
<addaction name="mActionReportSettings"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuSettings">
|
||||
<property name="title">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<addaction name="mActionOptions"/>
|
||||
</widget>
|
||||
<addaction name="mLayoutMenu"/>
|
||||
<addaction name="menuEdit"/>
|
||||
<addaction name="mMenuView"/>
|
||||
@ -296,6 +302,7 @@
|
||||
<addaction name="mItemMenu"/>
|
||||
<addaction name="mMenuAtlas"/>
|
||||
<addaction name="mMenuReport"/>
|
||||
<addaction name="menuSettings"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="mNavigationToolbar">
|
||||
<property name="windowTitle">
|
||||
@ -1498,6 +1505,21 @@
|
||||
<string>dsfg</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="mActionOptions">
|
||||
<property name="icon">
|
||||
<iconset resource="../../../images/images.qrc">
|
||||
<normaloff>:/images/themes/default/mActionOptions.svg</normaloff>:/images/themes/default/mActionOptions.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Layout &Options…</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Layout Options</string>
|
||||
</property>
|
||||
<property name="menuRole">
|
||||
<enum>QAction::PreferencesRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../../images/images.qrc"/>
|
||||
@ -1526,8 +1548,6 @@
|
||||
<include location="../../../images/images.qrc"/>
|
||||
<include location="../../../images/images.qrc"/>
|
||||
<include location="../../../images/images.qrc"/>
|
||||
<include location="../../../images/images.qrc"/>
|
||||
<include location="../../../images/images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
x
Reference in New Issue
Block a user