Skip to content

Commit f149730

Browse files
authoredDec 23, 2017
Merge pull request #5940 from nirvn/messagebar_link_color
2 parents e16dfe4 + aace710 commit f149730

File tree

2 files changed

+34
-27
lines changed

2 files changed

+34
-27
lines changed
 

‎src/app/layout/qgslayoutdesignerdialog.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ void QgsLayoutDesignerDialog::exportToRaster()
15381538
case QgsLayoutExporter::Success:
15391539
mMessageBar->pushMessage( tr( "Export layout" ),
15401540
tr( "Successfully exported layout to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( fi.path() ).toString(), fileNExt.first ),
1541-
QgsMessageBar::INFO, 0 );
1541+
QgsMessageBar::SUCCESS, 0 );
15421542
break;
15431543

15441544
case QgsLayoutExporter::PrintError:
@@ -1644,7 +1644,7 @@ void QgsLayoutDesignerDialog::exportToPdf()
16441644
{
16451645
mMessageBar->pushMessage( tr( "Export layout" ),
16461646
tr( "Successfully exported layout to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( fi.path() ).toString(), outputFileName ),
1647-
QgsMessageBar::INFO, 0 );
1647+
QgsMessageBar::SUCCESS, 0 );
16481648
break;
16491649
}
16501650

@@ -1794,7 +1794,7 @@ void QgsLayoutDesignerDialog::exportToSvg()
17941794
{
17951795
mMessageBar->pushMessage( tr( "Export layout" ),
17961796
tr( "Successfully exported layout to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( fi.path() ).toString(), outputFileName ),
1797-
QgsMessageBar::INFO, 0 );
1797+
QgsMessageBar::SUCCESS, 0 );
17981798
break;
17991799
}
18001800

‎src/gui/qgsmessagebaritem.cpp

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void QgsMessageBarItem::writeContent()
100100
msgIcon = QStringLiteral( "/mIconWarning.svg" );
101101
break;
102102
case QgsMessageBar::SUCCESS:
103-
msgIcon = QStringLiteral( "/mIconSuccess.png" );
103+
msgIcon = QStringLiteral( "/mIconSuccess.svg" );
104104
break;
105105
default:
106106
break;
@@ -109,6 +109,35 @@ void QgsMessageBarItem::writeContent()
109109
}
110110
mLblIcon->setPixmap( icon.pixmap( 24 ) );
111111

112+
113+
// STYLESHEETS
114+
QString contentStyleSheet;
115+
if ( mLevel == QgsMessageBar::SUCCESS )
116+
{
117+
mStyleSheet = "QgsMessageBar { background-color: #dff0d8; border: 1px solid #8e998a; } "
118+
"QLabel,QTextEdit { color: black; } ";
119+
contentStyleSheet = "<style> a, a:visited, a:hover { color:#268300; } </style>";
120+
}
121+
else if ( mLevel == QgsMessageBar::CRITICAL )
122+
{
123+
mStyleSheet = "QgsMessageBar { background-color: #d65253; border: 1px solid #9b3d3d; } "
124+
"QLabel,QTextEdit { color: white; } ";
125+
contentStyleSheet = "<style>a, a:visited, a:hover { color:#4e0001; }</style>";
126+
}
127+
else if ( mLevel == QgsMessageBar::WARNING )
128+
{
129+
mStyleSheet = "QgsMessageBar { background-color: #ffc800; border: 1px solid #e0aa00; } "
130+
"QLabel,QTextEdit { color: black; } ";
131+
contentStyleSheet = "<style>a, a:visited, a:hover { color:#945a00; }</style>";
132+
}
133+
else if ( mLevel == QgsMessageBar::INFO )
134+
{
135+
mStyleSheet = "QgsMessageBar { background-color: #e7f5fe; border: 1px solid #b9cfe4; } "
136+
"QLabel,QTextEdit { color: #2554a1; } ";
137+
contentStyleSheet = "<style>a, a:visited, a:hover { color:#3bb2fe; }</style>";
138+
}
139+
mStyleSheet += QLatin1String( "QLabel#mItemCount { font-style: italic; }" );
140+
112141
// TITLE AND TEXT
113142
if ( mTitle.isEmpty() && mText.isEmpty() )
114143
{
@@ -147,6 +176,7 @@ void QgsMessageBarItem::writeContent()
147176
t += QLatin1String( ": " );
148177
content.prepend( QStringLiteral( "<b>" ) + t + " </b>" );
149178
}
179+
content.prepend( contentStyleSheet );
150180
mTextBrowser->setText( content );
151181
}
152182

@@ -159,29 +189,6 @@ void QgsMessageBarItem::writeContent()
159189
mLayout->addWidget( mWidget );
160190
}
161191
}
162-
163-
// STYLESHEET
164-
if ( mLevel == QgsMessageBar::SUCCESS )
165-
{
166-
mStyleSheet = "QgsMessageBar { background-color: #dff0d8; border: 1px solid #8e998a; } "
167-
"QLabel,QTextEdit { color: black; } ";
168-
}
169-
else if ( mLevel == QgsMessageBar::CRITICAL )
170-
{
171-
mStyleSheet = "QgsMessageBar { background-color: #d65253; border: 1px solid #9b3d3d; } "
172-
"QLabel,QTextEdit { color: white; } ";
173-
}
174-
else if ( mLevel == QgsMessageBar::WARNING )
175-
{
176-
mStyleSheet = "QgsMessageBar { background-color: #ffc800; border: 1px solid #e0aa00; } "
177-
"QLabel,QTextEdit { color: black; } ";
178-
}
179-
else if ( mLevel == QgsMessageBar::INFO )
180-
{
181-
mStyleSheet = "QgsMessageBar { background-color: #e7f5fe; border: 1px solid #b9cfe4; } "
182-
"QLabel,QTextEdit { color: #2554a1; } ";
183-
}
184-
mStyleSheet += QLatin1String( "QLabel#mItemCount { font-style: italic; }" );
185192
}
186193

187194
QgsMessageBarItem *QgsMessageBarItem::setText( const QString &text )

0 commit comments

Comments
 (0)
Please sign in to comment.