Quantum GIS API Documentation  master-693a1fe
QgsMessageBar Class Reference

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

#include <qgsmessagebar.h>

+ Collaboration diagram for QgsMessageBar:

List of all members.

Classes

class  QgsMessageBarItem

Public Types

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

Public Slots

bool clearWidgets ()
bool popWidget ()

Signals

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

Public Member Functions

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

Static Public Member Functions

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

Protected Member Functions

void mousePressEvent (QMouseEvent *e)

Private Slots

void resetCountdown ()
void updateCountdown ()
 updates the countdown for widgets that have a timeout duration
void updateItemCount ()
 updates count of items in widget list

Private Member Functions

void popItem (QgsMessageBarItem *item)
void pushItem (QgsMessageBarItem *item)
void pushWidget (QWidget *widget, const QString &styleSheet, int duration=0)

Private Attributes

QAction * mActionCloseAll
QToolButton * mCloseBtn
QMenu * mCloseMenu
QTimer * mCountdownTimer
QProgressBar * mCountProgress
QString mCountStyleSheet
QgsMessageBarItemmCurrentItem
QLabel * mItemCount
QGridLayout * mLayout
QList< QgsMessageBarItem * > mList

Detailed Description

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

Note:
added in 1.9

Definition at line 41 of file qgsmessagebar.h.


Member Enumeration Documentation

Enumerator:
INFO 
WARNING 
CRITICAL 

Definition at line 46 of file qgsmessagebar.h.


Constructor & Destructor Documentation

Definition at line 102 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 204 of file qgsmessagebar.cpp.

References mCurrentItem, mList, and popWidget().

Referenced by QgsMessageBar().

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

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

Definition at line 72 of file qgsmessagebar.h.

References createMessage().

Referenced by createMessage(), and pushMessage().

static QWidget* QgsMessageBar::createMessage ( const QString &  text,
const QIcon &  icon,
QWidget *  parent = 0 
) [inline, static]

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

Definition at line 74 of file qgsmessagebar.h.

References createMessage().

Referenced by createMessage().

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

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

Definition at line 76 of file qgsmessagebar.h.

References createMessage().

Referenced by createMessage().

QWidget * QgsMessageBar::createMessage ( const QString &  title,
const QString &  text,
const QIcon &  icon,
QWidget *  parent = 0 
) [static]

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

Definition at line 288 of file qgsmessagebar.cpp.

void QgsMessageBar::mousePressEvent ( QMouseEvent *  e) [protected]

Definition at line 106 of file qgsmessagebar.cpp.

References mCountdownTimer, and mCountStyleSheet.

bool QgsMessageBar::popWidget ( QWidget *  widget)

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:
widgetwidget to remove
Returns:
true if the widget was removed, false otherwise

Definition at line 163 of file qgsmessagebar.cpp.

References mCurrentItem, mList, popItem(), and QgsMessageBar::QgsMessageBarItem::widget().

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 191 of file qgsmessagebar.cpp.

References mCurrentItem, popItem(), and resetCountdown().

Referenced by clearWidgets(), pushWidget(), QgsMessageBar(), and updateCountdown().

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

convenience method for pushing a non-widget-based message to the bar

Definition at line 81 of file qgsmessagebar.h.

References pushMessage().

Referenced by pushMessage().

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

convenience method for pushing a non-widget-based message with title to the bar

Definition at line 326 of file qgsmessagebar.cpp.

References createMessage(), CRITICAL, QgsApplication::getThemeIcon(), pushWidget(), and WARNING.

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

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

Parameters:
widgetwidget to add
levelis QgsMessageBar::INFO, WARNING or CRITICAL
durationtimeout duration of message in seconds, 0 value indicates no timeout

Definition at line 253 of file qgsmessagebar.cpp.

References CRITICAL, INFO, resetCountdown(), and WARNING.

Referenced by pushMessage().

void QgsMessageBar::pushWidget ( QWidget *  widget,
const QString &  styleSheet,
int  duration = 0 
) [private]

Definition at line 277 of file qgsmessagebar.cpp.

References popWidget(), and pushItem().

void QgsMessageBar::resetCountdown ( ) [private, slot]

Definition at line 362 of file qgsmessagebar.cpp.

References mCountdownTimer, mCountProgress, and mCountStyleSheet.

Referenced by popWidget(), pushWidget(), and updateCountdown().

void QgsMessageBar::updateCountdown ( ) [private, slot]

updates the countdown for widgets that have a timeout duration

Definition at line 345 of file qgsmessagebar.cpp.

References mCountdownTimer, mCountProgress, popWidget(), and resetCountdown().

Referenced by QgsMessageBar().

void QgsMessageBar::updateItemCount ( ) [private, slot]

updates count of items in widget list

Definition at line 371 of file qgsmessagebar.cpp.

References mItemCount, mList, and tr.

Referenced by QgsMessageBar().

void QgsMessageBar::widgetAdded ( QWidget *  widget) [signal]

emitted when a message widget is added to the bar

Referenced by pushItem(), and QgsMessageBar().

void QgsMessageBar::widgetRemoved ( QWidget *  widget) [signal]

emitted when a message widget was removed from the bar

Referenced by popItem(), and QgsMessageBar().


Member Data Documentation

QAction* QgsMessageBar::mActionCloseAll [private]

Definition at line 136 of file qgsmessagebar.h.

Referenced by QgsMessageBar().

QToolButton* QgsMessageBar::mCloseBtn [private]

Definition at line 133 of file qgsmessagebar.h.

Referenced by QgsMessageBar().

QMenu* QgsMessageBar::mCloseMenu [private]

Definition at line 132 of file qgsmessagebar.h.

Referenced by QgsMessageBar().

QProgressBar* QgsMessageBar::mCountProgress [private]

Definition at line 138 of file qgsmessagebar.h.

Referenced by pushItem(), QgsMessageBar(), resetCountdown(), and updateCountdown().

Definition at line 139 of file qgsmessagebar.h.

Referenced by mousePressEvent(), QgsMessageBar(), and resetCountdown().

QLabel* QgsMessageBar::mItemCount [private]

Definition at line 135 of file qgsmessagebar.h.

Referenced by QgsMessageBar(), and updateItemCount().

QGridLayout* QgsMessageBar::mLayout [private]

Definition at line 134 of file qgsmessagebar.h.

Referenced by popItem(), pushItem(), and QgsMessageBar().

Definition at line 131 of file qgsmessagebar.h.

Referenced by clearWidgets(), popItem(), popWidget(), pushItem(), and updateItemCount().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines