@@ -100,7 +100,7 @@ void QgsMessageBarItem::writeContent()
100
100
msgIcon = QStringLiteral ( " /mIconWarning.svg" );
101
101
break ;
102
102
case QgsMessageBar::SUCCESS:
103
- msgIcon = QStringLiteral ( " /mIconSuccess.png " );
103
+ msgIcon = QStringLiteral ( " /mIconSuccess.svg " );
104
104
break ;
105
105
default :
106
106
break ;
@@ -109,6 +109,35 @@ void QgsMessageBarItem::writeContent()
109
109
}
110
110
mLblIcon ->setPixmap ( icon.pixmap ( 24 ) );
111
111
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
+
112
141
// TITLE AND TEXT
113
142
if ( mTitle .isEmpty () && mText .isEmpty () )
114
143
{
@@ -147,6 +176,7 @@ void QgsMessageBarItem::writeContent()
147
176
t += QLatin1String ( " : " );
148
177
content.prepend ( QStringLiteral ( " <b>" ) + t + " </b>" );
149
178
}
179
+ content.prepend ( contentStyleSheet );
150
180
mTextBrowser ->setText ( content );
151
181
}
152
182
@@ -159,29 +189,6 @@ void QgsMessageBarItem::writeContent()
159
189
mLayout ->addWidget ( mWidget );
160
190
}
161
191
}
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; }" );
185
192
}
186
193
187
194
QgsMessageBarItem *QgsMessageBarItem::setText ( const QString &text )
0 commit comments