Skip to content

Commit 3f153e9

Browse files
authoredMar 26, 2018
[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.
1 parent 2b8519c commit 3f153e9

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed
 

‎src/app/qgsdecorationcopyright.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,11 @@ void QgsDecorationCopyright::projectRead()
5959
{
6060
QgsDecorationItem::projectRead();
6161

62-
QDate now = QDate::currentDate();
63-
QString defString = "© QGIS " + now.toString( QStringLiteral( "yyyy" ) );
64-
6562
// there is no font setting in the UI, so just use the Qt/QGIS default font (what mQFont gets when created)
6663
// mQFont.setFamily( QgsProject::instance()->readEntry( "CopyrightLabel", "/FontName", "Sans Serif" ) );
6764
// mQFont.setPointSize( QgsProject::instance()->readNumEntry( "CopyrightLabel", "/FontSize", 9 ) );
6865

69-
mLabelText = QgsProject::instance()->readEntry( mNameConfig, QStringLiteral( "/Label" ), defString );
66+
mLabelText = QgsProject::instance()->readEntry( mNameConfig, QStringLiteral( "/Label" ), QString() );
7067
mMarginHorizontal = QgsProject::instance()->readNumEntry( mNameConfig, QStringLiteral( "/MarginH" ), 0 );
7168
mMarginVertical = QgsProject::instance()->readNumEntry( mNameConfig, QStringLiteral( "/MarginV" ), 0 );
7269
mColor = QgsSymbolLayerUtils::decodeColor( QgsProject::instance()->readEntry( mNameConfig, QStringLiteral( "/Color" ), QStringLiteral( "#000000" ) ) );

‎src/app/qgsdecorationcopyrightdialog.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,19 @@ QgsDecorationCopyrightDialog::QgsDecorationCopyrightDialog( QgsDecorationCopyrig
4646
connect( applyButton, &QAbstractButton::clicked, this, &QgsDecorationCopyrightDialog::apply );
4747

4848
grpEnable->setChecked( mDeco.enabled() );
49-
// text
50-
txtCopyrightText->setPlainText( mDeco.mLabelText );
49+
50+
// label text
51+
if ( !mDeco.enabled() && mDeco.mLabelText.isEmpty() )
52+
{
53+
QDate now = QDate::currentDate();
54+
QString defaultString = QString( "%1 %2 %3" ).arg( QChar( 0x00A9 ), QgsProject::instance()->metadata().author(), now.toString( QStringLiteral( "yyyy" ) ) );
55+
txtCopyrightText->setPlainText( defaultString );
56+
}
57+
else
58+
{
59+
txtCopyrightText->setPlainText( mDeco.mLabelText );
60+
}
61+
5162
// placement
5263
cboPlacement->addItem( tr( "Top left" ), QgsDecorationItem::TopLeft );
5364
cboPlacement->addItem( tr( "Top right" ), QgsDecorationItem::TopRight );

0 commit comments

Comments
 (0)
Please sign in to comment.