QGIS API Documentation  3.4.15-Madeira (e83d02e274)
qgsstatusbar.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsstatusbar.h
3  --------------
4  begin : May 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
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 
18 #ifndef QGSSTATUSBAR_H
19 #define QGSSTATUSBAR_H
20 
21 #include "qgis_gui.h"
22 #include "qgis_sip.h"
23 #include <QWidget>
24 
25 class QHBoxLayout;
26 class QLineEdit;
27 class QStatusBar;
28 
46 class GUI_EXPORT QgsStatusBar : public QWidget
47 {
48  Q_OBJECT
49 
50  public:
51 
53  enum Anchor
54  {
55  AnchorLeft = 0,
57  };
58 
62  QgsStatusBar( QWidget *parent SIP_TRANSFERTHIS = nullptr );
63 
73  void addPermanentWidget( QWidget *widget SIP_TRANSFER, int stretch = 0, Anchor anchor = AnchorRight );
74 
79  void removeWidget( QWidget *widget );
80 
85  QString currentMessage() const;
86 
87  public slots:
88 
96  void showMessage( const QString &message, int timeout = 0 );
97 
102  void clearMessage();
103 
111  void setParentStatusBar( QStatusBar *statusBar );
112 
113 
114  protected:
115 
116  void changeEvent( QEvent *event ) override;
117 
118  private:
119 
120  QHBoxLayout *mLayout = nullptr;
121  QLineEdit *mLineEdit = nullptr;
122  QTimer *mTempMessageTimer = nullptr;
123  QStatusBar *mParentStatusBar = nullptr;
124  QMetaObject::Connection mShowMessageConnection;
125 
126 };
127 
128 #endif // QGSSTATUSBAR_H
129 
130 
Anchor
Placement anchor for widgets.
Definition: qgsstatusbar.h:53
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
#define SIP_TRANSFER
Definition: qgis_sip.h:36
Anchor widget to right of status bar.
Definition: qgsstatusbar.h:56
A proxy widget for QStatusBar.
Definition: qgsstatusbar.h:46