Skip to content

Commit 45942aa

Browse files
committedAug 31, 2012
move QgsMessageBar class to GUI library, improve its doc
1 parent 7a24104 commit 45942aa

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed
 

‎src/app/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ SET(QGIS_APP_SRCS
8585
qgsmeasuredialog.cpp
8686
qgsmeasuretool.cpp
8787
qgsmergeattributesdialog.cpp
88-
qgsmessagebar.cpp
8988
qgsoptions.cpp
9089
qgspastetransformations.cpp
9190
qgspointrotationitem.cpp
@@ -233,7 +232,6 @@ SET (QGIS_APP_MOC_HDRS
233232
qgsmeasuredialog.h
234233
qgsmeasuretool.h
235234
qgsmergeattributesdialog.h
236-
qgsmessagebar.h
237235
qgsoptions.h
238236
qgspastetransformations.h
239237
qgspluginmanager.h

‎src/gui/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ qgsmaptool.cpp
7171
qgsmaptoolemitpoint.cpp
7272
qgsmaptoolpan.cpp
7373
qgsmaptoolzoom.cpp
74+
qgsmessagebar.cpp
7475
qgsmessageviewer.cpp
7576
qgsmessagelogviewer.cpp
7677
qgsnewhttpconnection.cpp
@@ -160,6 +161,7 @@ qgsmanageconnectionsdialog.h
160161
qgsmapcanvas.h
161162
qgsmapoverviewcanvas.h
162163
qgsmaptoolemitpoint.h
164+
qgsmessagebar.h
163165
qgsmessageviewer.h
164166
qgsmessagelogviewer.h
165167
qgsnewhttpconnection.h
@@ -203,6 +205,7 @@ qgsmaptool.h
203205
qgsmaptoolemitpoint.h
204206
qgsmaptoolpan.h
205207
qgsmaptoolzoom.h
208+
qgsmessagebar.h
206209
qgsmessageviewer.h
207210
qgscredentialdialog.h
208211
qgsowssourceselect.h
File renamed without changes.

‎src/app/qgsmessagebar.h renamed to ‎src/gui/qgsmessagebar.h

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,46 @@ class QToolButton;
3131

3232
/** \ingroup gui
3333
* A bar for displaying non-blocking messages to the user.
34-
* \note added in 1.8
34+
* \note added in 1.9
3535
*/
36-
class QgsMessageBar: public QFrame
36+
class GUI_EXPORT QgsMessageBar: public QFrame
3737
{
3838
Q_OBJECT
39+
3940
public:
4041
QgsMessageBar( QWidget *parent = 0 );
4142
~QgsMessageBar();
4243

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

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

56+
//! make out a widget containing a message to be displayed on the bar
4857
static QWidget* createMessage( const QString &text, QWidget *parent = 0 ) { return createMessage( QString::null, text, QIcon(), parent ); }
58+
//! make out a widget containing icon and message to be displayed on the bar
4959
static QWidget* createMessage( const QString &text, const QIcon &icon, QWidget *parent = 0 ) { return createMessage( QString::null, text, icon, parent ); }
60+
//! make out a widget containing title and message to be displayed on the bar
5061
static QWidget* createMessage( const QString &title, const QString &text, QWidget *parent = 0 ) { return createMessage( title, text, QIcon(), parent ); }
62+
//! make out a widget containing icon, title and message to be displayed on the bar
5163
static QWidget* createMessage( const QString &title, const QString &text, const QIcon &icon, QWidget *parent = 0 );
5264

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

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

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

92+
//! display a widget on the bar
93+
void pushWidget( QWidget *widget, const QString &styleSheet );
94+
7595
void popItem( QgsMessageBarItem *item );
7696
void pushItem( QgsMessageBarItem *item );
7797

0 commit comments

Comments
 (0)
Please sign in to comment.