Skip to content
Permalink
Browse files
[copyright decorator] improve default label string
- Instead of using (c) QGIS YYYY, rely on the project metadata
to insert the author name. It's a more useful default string,
and might help avoid a misconception about ownership of maps
produced in QGIS.
  • Loading branch information
nirvn committed Mar 26, 2018
1 parent 2b8519c commit 3f153e9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
@@ -59,14 +59,11 @@ void QgsDecorationCopyright::projectRead()
{
QgsDecorationItem::projectRead();

QDate now = QDate::currentDate();
QString defString = "© QGIS " + now.toString( QStringLiteral( "yyyy" ) );

// there is no font setting in the UI, so just use the Qt/QGIS default font (what mQFont gets when created)
// mQFont.setFamily( QgsProject::instance()->readEntry( "CopyrightLabel", "/FontName", "Sans Serif" ) );
// mQFont.setPointSize( QgsProject::instance()->readNumEntry( "CopyrightLabel", "/FontSize", 9 ) );

mLabelText = QgsProject::instance()->readEntry( mNameConfig, QStringLiteral( "/Label" ), defString );
mLabelText = QgsProject::instance()->readEntry( mNameConfig, QStringLiteral( "/Label" ), QString() );
mMarginHorizontal = QgsProject::instance()->readNumEntry( mNameConfig, QStringLiteral( "/MarginH" ), 0 );
mMarginVertical = QgsProject::instance()->readNumEntry( mNameConfig, QStringLiteral( "/MarginV" ), 0 );
mColor = QgsSymbolLayerUtils::decodeColor( QgsProject::instance()->readEntry( mNameConfig, QStringLiteral( "/Color" ), QStringLiteral( "#000000" ) ) );
@@ -46,8 +46,19 @@ QgsDecorationCopyrightDialog::QgsDecorationCopyrightDialog( QgsDecorationCopyrig
connect( applyButton, &QAbstractButton::clicked, this, &QgsDecorationCopyrightDialog::apply );

grpEnable->setChecked( mDeco.enabled() );
// text
txtCopyrightText->setPlainText( mDeco.mLabelText );

// label text
if ( !mDeco.enabled() && mDeco.mLabelText.isEmpty() )
{
QDate now = QDate::currentDate();
QString defaultString = QString( "%1 %2 %3" ).arg( QChar( 0x00A9 ), QgsProject::instance()->metadata().author(), now.toString( QStringLiteral( "yyyy" ) ) );
txtCopyrightText->setPlainText( defaultString );
}
else
{
txtCopyrightText->setPlainText( mDeco.mLabelText );
}

// placement
cboPlacement->addItem( tr( "Top left" ), QgsDecorationItem::TopLeft );
cboPlacement->addItem( tr( "Top right" ), QgsDecorationItem::TopRight );

0 comments on commit 3f153e9

Please sign in to comment.