QGIS/python/gui/qgsmessagebar.sip

73 lines
2.7 KiB
Plaintext
Raw Normal View History

2012-09-04 18:31:51 +10:00
class QgsMessageBar: QFrame
{
%TypeHeaderCode
#include <qgsmessagebar.h>
%End
public:
enum MessageLevel
{
INFO = 0,
WARNING = 1,
CRITICAL = 2
};
2012-09-04 18:31:51 +10:00
QgsMessageBar( QWidget *parent = 0 );
~QgsMessageBar();
/*! display a message item on the bar after hiding the currently visible one
* and putting it in a stack.
* @param item item to display
*/
void pushItem( QgsMessageBarItem *item /Transfer/);
/*! 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 duration timeout duration of message in seconds, 0 value indicates no timeout
2012-09-04 18:31:51 +10:00
*/
QgsMessageBarItem *pushWidget( QWidget *widget /Transfer/, MessageLevel level = INFO, int duration = 0 );
2012-09-04 18:31:51 +10:00
/*! remove the passed widget from the bar (if previously added),
* then display the next one in the stack if any or hide the bar
2014-01-27 09:22:24 +01:00
* @param item item to remove
2012-09-04 18:31:51 +10:00
* @return true if the widget was removed, false otherwise
*/
bool popWidget( QgsMessageBarItem *item );
2012-09-04 18:31:51 +10:00
2014-01-27 09:22:24 +01:00
//! make out a widget containing a message to be displayed on the bar
static QgsMessageBarItem* createMessage( const QString &text, QWidget *parent = 0 ) /Factory/;
2012-09-04 18:31:51 +10:00
//! make out a widget containing title and message to be displayed on the bar
static QgsMessageBarItem* createMessage( const QString &title, const QString &text, QWidget *parent = 0 ) /Factory/;
2014-01-27 09:22:24 +01:00
//! make out a widget containing title and message to be displayed on the bar
static QgsMessageBarItem* createMessage( QWidget *widget, QWidget *parent = 0 ) /Factory/;
2014-01-27 09:22:24 +01:00
//! convenience method for pushing a message to the bar
2013-08-16 00:00:04 +10:00
void pushMessage( const QString &text, MessageLevel level = INFO, int duration = 0 );
2014-01-27 09:22:24 +01:00
//! convenience method for pushing a message with title to the bar
2013-08-16 00:00:04 +10:00
void pushMessage( const QString &title, const QString &text, MessageLevel level = INFO, int duration = 0 );
2012-09-04 18:31:51 +10:00
signals:
2012-11-07 12:45:00 -07:00
//! emitted when a message widget is added to the bar
void widgetAdded( QgsMessageBarItem *item );
2012-11-07 12:45:00 -07:00
2014-01-27 09:22:24 +01:00
//! emitted when a message widget was removed from the bar
void widgetRemoved( QgsMessageBarItem *item );
2012-09-04 18:31:51 +10:00
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();
2012-11-07 12:45:00 -07:00
/*! remove all items from the bar's widget list
* @return true if all items were removed, false otherwise
*/
bool clearWidgets();
protected:
void mousePressEvent( QMouseEvent * e );
2012-09-04 18:31:51 +10:00
};