Skip to content
Permalink
Browse files

move QgsMessageBar class to GUI library, improve its doc

  • Loading branch information
brushtyler committed Aug 31, 2012
1 parent 7a24104 commit 45942aa59c1b269e34d6f85ce106ffd9d2648cde
@@ -85,7 +85,6 @@ SET(QGIS_APP_SRCS
qgsmeasuredialog.cpp
qgsmeasuretool.cpp
qgsmergeattributesdialog.cpp
qgsmessagebar.cpp
qgsoptions.cpp
qgspastetransformations.cpp
qgspointrotationitem.cpp
@@ -233,7 +232,6 @@ SET (QGIS_APP_MOC_HDRS
qgsmeasuredialog.h
qgsmeasuretool.h
qgsmergeattributesdialog.h
qgsmessagebar.h
qgsoptions.h
qgspastetransformations.h
qgspluginmanager.h
@@ -71,6 +71,7 @@ qgsmaptool.cpp
qgsmaptoolemitpoint.cpp
qgsmaptoolpan.cpp
qgsmaptoolzoom.cpp
qgsmessagebar.cpp
qgsmessageviewer.cpp
qgsmessagelogviewer.cpp
qgsnewhttpconnection.cpp
@@ -160,6 +161,7 @@ qgsmanageconnectionsdialog.h
qgsmapcanvas.h
qgsmapoverviewcanvas.h
qgsmaptoolemitpoint.h
qgsmessagebar.h
qgsmessageviewer.h
qgsmessagelogviewer.h
qgsnewhttpconnection.h
@@ -203,6 +205,7 @@ qgsmaptool.h
qgsmaptoolemitpoint.h
qgsmaptoolpan.h
qgsmaptoolzoom.h
qgsmessagebar.h
qgsmessageviewer.h
qgscredentialdialog.h
qgsowssourceselect.h
File renamed without changes.
@@ -31,29 +31,46 @@ class QToolButton;

/** \ingroup gui
* A bar for displaying non-blocking messages to the user.
* \note added in 1.8
* \note added in 1.9
*/
class QgsMessageBar: public QFrame
class GUI_EXPORT QgsMessageBar: public QFrame
{
Q_OBJECT

public:
QgsMessageBar( QWidget *parent = 0 );
~QgsMessageBar();

/*! display a widget on the bar after hiding the currently visible one
* and putting it in a stack
* @param level is 0 for information, 1 for warning, 2 for critical
*/
void pushWidget( QWidget *widget, int level = 0 );
void pushWidget( QWidget *widget, const QString &styleSheet );

/*! remove the passed widget from the bar (if previously added),
* then display the next one in the stack if any or hide the bar
* @return true if the widget was removed, false otherwise
*/
bool popWidget( QWidget *widget );

//! make out a widget containing a message to be displayed on the bar
static QWidget* createMessage( const QString &text, QWidget *parent = 0 ) { return createMessage( QString::null, text, QIcon(), parent ); }
//! make out a widget containing icon and message to be displayed on the bar
static QWidget* createMessage( const QString &text, const QIcon &icon, QWidget *parent = 0 ) { return createMessage( QString::null, text, icon, parent ); }
//! make out a widget containing title and message to be displayed on the bar
static QWidget* createMessage( const QString &title, const QString &text, QWidget *parent = 0 ) { return createMessage( title, text, QIcon(), parent ); }
//! make out a widget containing icon, title and message to be displayed on the bar
static QWidget* createMessage( const QString &title, const QString &text, const QIcon &icon, QWidget *parent = 0 );

signals:
//! emitted when a widget was removed from the bar
void widgetRemoved( QWidget *widget );

public slots:
/*! remove the currently displayed widget from the bar and
* display the next in the stack if any or hide the bar
* @return true if the widget was removed, false otherwise
*/
bool popWidget();

private:
@@ -72,6 +89,9 @@ class QgsMessageBar: public QFrame
QString mStyleSheet;
};

//! display a widget on the bar
void pushWidget( QWidget *widget, const QString &styleSheet );

void popItem( QgsMessageBarItem *item );
void pushItem( QgsMessageBarItem *item );

0 comments on commit 45942aa

Please sign in to comment.
You can’t perform that action at this time.