added QgsMessageBar::SUCCESS

This commit is contained in:
Marco Bernasocchi 2014-12-14 15:55:50 +01:00
parent fc00baf0f1
commit b6632a81aa
3 changed files with 15 additions and 5 deletions

View File

@ -10,6 +10,7 @@ class QgsMessageBar: QFrame
INFO,
WARNING,
CRITICAL,
SUCCESS
};
QgsMessageBar( QWidget *parent = 0 );
@ -24,7 +25,7 @@ class QgsMessageBar: QFrame
/*! display a widget as a message on the bar after hiding the currently visible one
* and putting it in a stack.
* @param widget message widget to display
* @param level is QgsMessageBar::INFO, WARNING or CRITICAL
* @param level is QgsMessageBar::INFO, WARNING, CRITICAL or SUCCESS
* @param duration timeout duration of message in seconds, 0 value indicates no timeout
*/
QgsMessageBarItem *pushWidget( QWidget *widget /Transfer/, MessageLevel level = INFO, int duration = 0 );

View File

@ -48,7 +48,8 @@ class GUI_EXPORT QgsMessageBar: public QFrame
{
INFO = 0,
WARNING = 1,
CRITICAL = 2
CRITICAL = 2,
SUCCESS = 3
};
QgsMessageBar( QWidget *parent = 0 );
@ -63,7 +64,7 @@ class GUI_EXPORT QgsMessageBar: public QFrame
/*! display a widget as a message on the bar after hiding the currently visible one
* and putting it in a stack.
* @param widget message widget to display
* @param level is QgsMessageBar::INFO, WARNING or CRITICAL
* @param level is QgsMessageBar::INFO, WARNING, CRITICAL or SUCCESS
* @param duration timeout duration of message in seconds, 0 value indicates no timeout
*/
QgsMessageBarItem *pushWidget( QWidget *widget, MessageLevel level = INFO, int duration = 0 );

View File

@ -111,6 +111,9 @@ void QgsMessageBarItem::writeContent()
case QgsMessageBar::WARNING:
msgIcon = QString( "/mIconWarn.png" );
break;
case QgsMessageBar::SUCCESS:
msgIcon = QString( "/mActionCheckQgisVersion.png" );
break;
default:
break;
}
@ -167,7 +170,12 @@ void QgsMessageBarItem::writeContent()
}
// STYLESHEET
if ( mLevel >= QgsMessageBar::CRITICAL )
if ( mLevel == QgsMessageBar::SUCCESS )
{
mStyleSheet = "QgsMessageBar { background-color: #dff0d8; border: 1px solid #8e998a; } "
"QLabel,QTextEdit { color: black; } ";
}
else if ( mLevel == QgsMessageBar::CRITICAL )
{
mStyleSheet = "QgsMessageBar { background-color: #d65253; border: 1px solid #9b3d3d; } "
"QLabel,QTextEdit { color: white; } ";
@ -177,7 +185,7 @@ void QgsMessageBarItem::writeContent()
mStyleSheet = "QgsMessageBar { background-color: #ffc800; border: 1px solid #e0aa00; } "
"QLabel,QTextEdit { color: black; } ";
}
else if ( mLevel <= QgsMessageBar::INFO )
else if ( mLevel == QgsMessageBar::INFO )
{
mStyleSheet = "QgsMessageBar { background-color: #e7f5fe; border: 1px solid #b9cfe4; } "
"QLabel,QTextEdit { color: #2554a1; } ";