QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
QgsMessageBar Class Reference

A bar for displaying non-blocking messages to the user. More...

#include <qgsmessagebar.h>

Public Types

enum  MessageLevel { INFO = 0, WARNING = 1, CRITICAL = 2, SUCCESS = 3 }

Public Slots

bool clearWidgets ()
bool popWidget ()
void pushCritical (const QString &title, const QString &message)
 Pushes a warning with default timeout to the message bar.
void pushInfo (const QString &title, const QString &message)
 Pushes a warning with default timeout to the message bar.
void pushSuccess (const QString &title, const QString &message)
 Pushes a warning with default timeout to the message bar.
void pushWarning (const QString &title, const QString &message)
 Pushes a warning with default timeout to the message bar.

Signals

void widgetAdded (QgsMessageBarItem *item)
 emitted when a message widget is added to the bar
void widgetRemoved (QgsMessageBarItem *item)
 emitted when a message widget was removed from the bar

Public Member Functions

 QgsMessageBar (QWidget *parent=0)
 ~QgsMessageBar ()
bool popWidget (QgsMessageBarItem *item)
void pushItem (QgsMessageBarItem *item)
void pushMessage (const QString &text, MessageLevel level=INFO, int duration=0)
 convenience method for pushing a message to the bar
void pushMessage (const QString &title, const QString &text, MessageLevel level=INFO, int duration=0)
 convenience method for pushing a message with title to the bar
QgsMessageBarItempushWidget (QWidget *widget, MessageLevel level=INFO, int duration=0)

Static Public Member Functions

static QgsMessageBarItemcreateMessage (const QString &text, QWidget *parent=0)
 make out a widget containing a message to be displayed on the bar
static QgsMessageBarItemcreateMessage (const QString &title, const QString &text, QWidget *parent=0)
 make out a widget containing title and message to be displayed on the bar
static QgsMessageBarItemcreateMessage (QWidget *widget, QWidget *parent=0)
 make out a widget containing title and message to be displayed on the bar

Protected Member Functions

void mousePressEvent (QMouseEvent *e) override

Detailed Description

A bar for displaying non-blocking messages to the user.

Definition at line 42 of file qgsmessagebar.h.

Member Enumeration Documentation

Enumerator:
INFO 
WARNING 
CRITICAL 
SUCCESS 

Definition at line 47 of file qgsmessagebar.h.

Constructor & Destructor Documentation

QgsMessageBar::QgsMessageBar ( QWidget *  parent = 0)

Definition at line 33 of file qgsmessagebar.cpp.

QgsMessageBar::~QgsMessageBar ( )

Definition at line 101 of file qgsmessagebar.cpp.

Member Function Documentation

bool QgsMessageBar::clearWidgets ( )
slot

remove all items from the bar's widget list

Returns
true if all items were removed, false otherwise

Definition at line 195 of file qgsmessagebar.cpp.

QgsMessageBarItem * QgsMessageBar::createMessage ( const QString &  text,
QWidget *  parent = 0 
)
static

make out a widget containing a message to be displayed on the bar

Definition at line 298 of file qgsmessagebar.cpp.

QgsMessageBarItem * QgsMessageBar::createMessage ( const QString &  title,
const QString &  text,
QWidget *  parent = 0 
)
static

make out a widget containing title and message to be displayed on the bar

Definition at line 304 of file qgsmessagebar.cpp.

QgsMessageBarItem * QgsMessageBar::createMessage ( QWidget *  widget,
QWidget *  parent = 0 
)
static

make out a widget containing title and message to be displayed on the bar

Definition at line 309 of file qgsmessagebar.cpp.

void QgsMessageBar::mousePressEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 105 of file qgsmessagebar.cpp.

bool QgsMessageBar::popWidget ( QgsMessageBarItem item)

remove the passed widget from the bar (if previously added), then display the next one in the stack if any or hide the bar

Parameters
itemitem to remove
Returns
true if the widget was removed, false otherwise

Definition at line 158 of file qgsmessagebar.cpp.

bool QgsMessageBar::popWidget ( )
slot

remove the currently displayed widget from the bar and display the next in the stack if any or hide the bar

Returns
true if the widget was removed, false otherwise

Definition at line 182 of file qgsmessagebar.cpp.

void QgsMessageBar::pushCritical ( const QString &  title,
const QString &  message 
)
slot

Pushes a warning with default timeout to the message bar.

Parameters
titletitle string for message
messageThe message to be displayed
Note
added in 2.8

Definition at line 224 of file qgsmessagebar.cpp.

void QgsMessageBar::pushInfo ( const QString &  title,
const QString &  message 
)
slot

Pushes a warning with default timeout to the message bar.

Parameters
titletitle string for message
messageThe message to be displayed
Note
added in 2.8

Definition at line 214 of file qgsmessagebar.cpp.

void QgsMessageBar::pushItem ( QgsMessageBarItem item)

display a message item on the bar after hiding the currently visible one and putting it in a stack.

Parameters
itemitem to display

Definition at line 268 of file qgsmessagebar.cpp.

void QgsMessageBar::pushMessage ( const QString &  text,
MessageLevel  level = INFO,
int  duration = 0 
)
inline

convenience method for pushing a message to the bar

Definition at line 87 of file qgsmessagebar.h.

void QgsMessageBar::pushMessage ( const QString &  title,
const QString &  text,
QgsMessageBar::MessageLevel  level = INFO,
int  duration = 0 
)

convenience method for pushing a message with title to the bar

Definition at line 292 of file qgsmessagebar.cpp.

void QgsMessageBar::pushSuccess ( const QString &  title,
const QString &  message 
)
slot

Pushes a warning with default timeout to the message bar.

Parameters
titletitle string for message
messageThe message to be displayed
Note
added in 2.8

Definition at line 209 of file qgsmessagebar.cpp.

void QgsMessageBar::pushWarning ( const QString &  title,
const QString &  message 
)
slot

Pushes a warning with default timeout to the message bar.

Parameters
titletitle string for message
messageThe message to be displayed
Note
added in 2.8

Definition at line 219 of file qgsmessagebar.cpp.

QgsMessageBarItem * QgsMessageBar::pushWidget ( QWidget *  widget,
QgsMessageBar::MessageLevel  level = INFO,
int  duration = 0 
)

display a widget as a message on the bar after hiding the currently visible one and putting it in a stack.

Parameters
widgetmessage widget to display
levelis QgsMessageBar::INFO, WARNING, CRITICAL or SUCCESS
durationtimeout duration of message in seconds, 0 value indicates no timeout

Definition at line 276 of file qgsmessagebar.cpp.

void QgsMessageBar::widgetAdded ( QgsMessageBarItem item)
signal

emitted when a message widget is added to the bar

void QgsMessageBar::widgetRemoved ( QgsMessageBarItem item)
signal

emitted when a message widget was removed from the bar


The documentation for this class was generated from the following files: