Skip to content

Commit

Permalink
Add convenience slots to QgsMessageBar
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jan 22, 2015
1 parent 4a8bcc9 commit eaca080
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/gui/qgsmessagebar.cpp
Expand Up @@ -206,6 +206,26 @@ bool QgsMessageBar::clearWidgets()
return !mCurrentItem && mItems.empty();
}

void QgsMessageBar::pushSuccess( const QString& title, const QString& message )
{
pushMessage( title, message, SUCCESS );
}

void QgsMessageBar::pushInfo( const QString& title, const QString& message )
{
pushMessage( title, message, INFO );
}

void QgsMessageBar::pushWarning( const QString& title, const QString& message )
{
pushMessage( title, message, WARNING );
}

void QgsMessageBar::pushCritical( const QString& title, const QString& message )
{
pushMessage( title, message, CRITICAL );
}

void QgsMessageBar::showItem( QgsMessageBarItem *item )
{
Q_ASSERT( item );
Expand Down
28 changes: 28 additions & 0 deletions src/gui/qgsmessagebar.h
Expand Up @@ -107,6 +107,34 @@ class GUI_EXPORT QgsMessageBar: public QFrame
*/
bool clearWidgets();

/**
* Pushes a warning with default timeout to the message bar
* @param message The message to be displayed
* @note added in 2.8
*/
void pushSuccess( const QString& title, const QString& message );

/**
* Pushes a warning with default timeout to the message bar
* @param message The message to be displayed
* @note added in 2.8
*/
void pushInfo( const QString& title, const QString& message );

/**
* Pushes a warning with default timeout to the message bar
* @param message The message to be displayed
* @note added in 2.8
*/
void pushWarning( const QString& title, const QString& message );

/**
* Pushes a warning with default timeout to the message bar
* @param message The message to be displayed
* @note added in 2.8
*/
void pushCritical( const QString& title, const QString& message );

protected:
void mousePressEvent( QMouseEvent * e ) override;

Expand Down

0 comments on commit eaca080

Please sign in to comment.