QGIS API Documentation  2.3.0-Master
 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 | Private Slots | Private Member Functions | Private Attributes | List of all members
QgsMessageBar Class Reference

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

#include <qgsmessagebar.h>

Inheritance diagram for QgsMessageBar:
Inheritance graph
[legend]
Collaboration diagram for QgsMessageBar:
Collaboration graph
[legend]

Public Types

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

Public Slots

bool popWidget ()
 
bool clearWidgets ()
 

Signals

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

Public Member Functions

 QgsMessageBar (QWidget *parent=0)
 
 ~QgsMessageBar ()
 
void pushItem (QgsMessageBarItem *item)
 
QgsMessageBarItempushWidget (QWidget *widget, MessageLevel level=INFO, int duration=0)
 
bool popWidget (QgsMessageBarItem *item)
 
void pushMessage (const QString &text, MessageLevel level=INFO, int duration=0)
 convenience method for pushing a message to the bar More...
 
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 More...
 

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 More...
 
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 More...
 
static QgsMessageBarItemcreateMessage (QWidget *widget, QWidget *parent=0)
 make out a widget containing title and message to be displayed on the bar More...
 

Protected Member Functions

void mousePressEvent (QMouseEvent *e)
 

Private Slots

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

Private Member Functions

void popItem (QgsMessageBarItem *item)
 
void showItem (QgsMessageBarItem *item)
 

Private Attributes

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

Detailed Description

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

Note
added in 1.9

Definition at line 43 of file qgsmessagebar.h.

Member Enumeration Documentation

Enumerator
INFO 
WARNING 
CRITICAL 

Definition at line 48 of file qgsmessagebar.h.

Constructor & Destructor Documentation

QgsMessageBar::QgsMessageBar ( QWidget *  parent = 0)
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.

References mCurrentItem, mItems, and popWidget().

Referenced by QgsMessageBar().

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

References INFO.

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

References INFO.

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

References INFO.

void QgsMessageBar::mousePressEvent ( QMouseEvent *  e)
protected

Definition at line 105 of file qgsmessagebar.cpp.

References mCountdownTimer, mCountProgress, and mCountStyleSheet.

void QgsMessageBar::popItem ( QgsMessageBarItem item)
private

Definition at line 122 of file qgsmessagebar.cpp.

References mCurrentItem, mItems, mLayout, showItem(), and widgetRemoved().

Referenced by popWidget().

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.

References mCurrentItem, mItems, and popItem().

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.

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

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

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

References popWidget(), resetCountdown(), and showItem().

Referenced by pushMessage(), and pushWidget().

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.

References pushMessage().

Referenced by pushMessage().

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

References pushItem().

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 or CRITICAL
durationtimeout duration of message in seconds, 0 value indicates no timeout

Definition at line 256 of file qgsmessagebar.cpp.

References pushItem(), QgsMessageBarItem::setDuration(), and QgsMessageBarItem::setLevel().

void QgsMessageBar::resetCountdown ( )
privateslot

Definition at line 311 of file qgsmessagebar.cpp.

References mCountdownTimer, mCountProgress, and mCountStyleSheet.

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

void QgsMessageBar::showItem ( QgsMessageBarItem item)
private
void QgsMessageBar::updateCountdown ( )
privateslot

updates the countdown for widgets that have a timeout duration

Definition at line 294 of file qgsmessagebar.cpp.

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

Referenced by QgsMessageBar().

void QgsMessageBar::updateItemCount ( )
privateslot

updates count of items in widget list

Definition at line 320 of file qgsmessagebar.cpp.

References mCloseBtn, mCloseMenu, mItemCount, mItems, and tr.

Referenced by QgsMessageBar().

void QgsMessageBar::widgetAdded ( QgsMessageBarItem item)
signal

emitted when a message widget is added to the bar

Referenced by QgsMessageBar(), and showItem().

void QgsMessageBar::widgetRemoved ( QgsMessageBarItem item)
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 122 of file qgsmessagebar.h.

Referenced by QgsMessageBar().

QToolButton* QgsMessageBar::mCloseBtn
private

Definition at line 119 of file qgsmessagebar.h.

Referenced by QgsMessageBar(), and updateItemCount().

QMenu* QgsMessageBar::mCloseMenu
private

Definition at line 118 of file qgsmessagebar.h.

Referenced by QgsMessageBar(), and updateItemCount().

QTimer* QgsMessageBar::mCountdownTimer
private
QProgressBar* QgsMessageBar::mCountProgress
private
QString QgsMessageBar::mCountStyleSheet
private

Definition at line 125 of file qgsmessagebar.h.

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

QgsMessageBarItem* QgsMessageBar::mCurrentItem
private

Definition at line 116 of file qgsmessagebar.h.

Referenced by clearWidgets(), popItem(), popWidget(), and showItem().

QLabel* QgsMessageBar::mItemCount
private

Definition at line 121 of file qgsmessagebar.h.

Referenced by QgsMessageBar(), and updateItemCount().

QList<QgsMessageBarItem *> QgsMessageBar::mItems
private

Definition at line 117 of file qgsmessagebar.h.

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

QGridLayout* QgsMessageBar::mLayout
private

Definition at line 120 of file qgsmessagebar.h.

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


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