Skip to content

Commit

Permalink
move QgsMessageBar class to GUI library, improve its doc
Browse files Browse the repository at this point in the history
  • Loading branch information
brushtyler committed Aug 31, 2012
1 parent 7a24104 commit 45942aa
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/app/CMakeLists.txt
Expand Up @@ -85,7 +85,6 @@ SET(QGIS_APP_SRCS
qgsmeasuredialog.cpp
qgsmeasuretool.cpp
qgsmergeattributesdialog.cpp
qgsmessagebar.cpp
qgsoptions.cpp
qgspastetransformations.cpp
qgspointrotationitem.cpp
Expand Down Expand Up @@ -233,7 +232,6 @@ SET (QGIS_APP_MOC_HDRS
qgsmeasuredialog.h
qgsmeasuretool.h
qgsmergeattributesdialog.h
qgsmessagebar.h
qgsoptions.h
qgspastetransformations.h
qgspluginmanager.h
Expand Down
3 changes: 3 additions & 0 deletions src/gui/CMakeLists.txt
Expand Up @@ -71,6 +71,7 @@ qgsmaptool.cpp
qgsmaptoolemitpoint.cpp
qgsmaptoolpan.cpp
qgsmaptoolzoom.cpp
qgsmessagebar.cpp
qgsmessageviewer.cpp
qgsmessagelogviewer.cpp
qgsnewhttpconnection.cpp
Expand Down Expand Up @@ -160,6 +161,7 @@ qgsmanageconnectionsdialog.h
qgsmapcanvas.h
qgsmapoverviewcanvas.h
qgsmaptoolemitpoint.h
qgsmessagebar.h
qgsmessageviewer.h
qgsmessagelogviewer.h
qgsnewhttpconnection.h
Expand Down Expand Up @@ -203,6 +205,7 @@ qgsmaptool.h
qgsmaptoolemitpoint.h
qgsmaptoolpan.h
qgsmaptoolzoom.h
qgsmessagebar.h
qgsmessageviewer.h
qgscredentialdialog.h
qgsowssourceselect.h
Expand Down
File renamed without changes.
26 changes: 23 additions & 3 deletions src/app/qgsmessagebar.h → src/gui/qgsmessagebar.h
Expand Up @@ -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:
Expand All @@ -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 );

Expand Down

0 comments on commit 45942aa

Please sign in to comment.