QGIS API Documentation  2.2.0-Valmiera
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsmessagebaritem.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmessagebaritem.h - description
3  -------------------
4  begin : August 2013
5  copyright : (C) 2013 by Denis Rouzaud
6  email : [email protected]
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 #ifndef qgsmessagebaritem_H
18 #define qgsmessagebaritem_H
19 
20 #include <qgsmessagebaritem.h>
21 #include <qgsmessagebar.h>
22 
23 #include <QWidget>
24 #include <QIcon>
25 #include <QTextEdit>
26 #include <QHBoxLayout>
27 
28 
29 class GUI_EXPORT QgsMessageBarItem : public QWidget
30 {
31  Q_OBJECT
32  public:
34  QgsMessageBarItem( const QString &text, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = 0, QWidget *parent = 0 );
35 
37  QgsMessageBarItem( const QString &title, const QString &text, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = 0, QWidget *parent = 0 );
38 
40  QgsMessageBarItem( const QString &title, const QString &text, QWidget *widget, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = 0, QWidget *parent = 0 );
41 
43  QgsMessageBarItem( QWidget *widget, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = 0, QWidget *parent = 0 );
44 
46 
47  QgsMessageBarItem *setText( QString text );
48 
49  QgsMessageBarItem *setTitle( QString title );
50 
52 
53  QgsMessageBarItem *setWidget( QWidget *widget );
54 
55  QgsMessageBarItem *setIcon( const QIcon &icon );
56 
57  QgsMessageBarItem *setDuration( int duration );
58 
60  int duration() const { return mDuration; }
61 
63  QgsMessageBar::MessageLevel level() { return mLevel; }
64 
66  QString getStyleSheet() { return mStyleSheet; }
67 
68  signals:
70  void styleChanged( QString styleSheet );
71 
72 
73  private:
74  void writeContent();
75 
76  QString mTitle;
77  QString mText;
79  int mDuration;
80  QWidget *mWidget;
81  QIcon mUserIcon;
82  QHBoxLayout *mLayout;
83  QLabel *mLblIcon;
84  QString mStyleSheet;
85  QTextEdit *mTextEdit;
86 };
87 
88 #endif // qgsmessagebaritem_H