QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgstabwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstabwidget.h - QgsTabWidget
3 
4  ---------------------
5  begin : 8.9.2016
6  copyright : (C) 2016 by Matthias Kuhn
7  email : [email protected]
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 #ifndef QGSTABWIDGET_H
17 #define QGSTABWIDGET_H
18 
19 #include <QTabWidget>
20 
27 class GUI_EXPORT QgsTabWidget : public QTabWidget
28 {
29  Q_OBJECT
30 
31  public:
37  QgsTabWidget( QWidget *parent = nullptr );
38 
44  void hideTab( QWidget* tab );
45 
51  void showTab( QWidget* tab );
52 
58  void setTabVisible( QWidget* tab, bool visible );
59 
67  int realTabIndex( QWidget* widget );
68 
76  virtual void tabInserted( int index ) override;
77 
85  virtual void tabRemoved( int index ) override;
86 
87  private:
88  void synchronizeIndexes();
89 
90  struct TabInformation
91  {
92  TabInformation( QWidget* wdg, const QString& lbl )
93  : sourceIndex( -1 )
94  , widget( wdg )
95  , label( lbl )
96  , visible( true )
97  {}
98 
99  TabInformation()
100  : sourceIndex( -1 )
101  , widget( nullptr )
102  , visible( true )
103  {}
104 
105  bool operator ==( const TabInformation& other );
106 
107  int sourceIndex;
108  QWidget* widget;
109  QString label;
110  bool visible;
111  };
112 
113  TabInformation tabInfo( QWidget* widget );
114 
115  QList<TabInformation> mTabs;
116  bool mSetTabVisibleFlag;
117 };
118 
119 #endif // QGSTABWIDGET_H
static unsigned index
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
virtual void tabInserted(int index)
virtual void tabRemoved(int index)
The QgsTabWidget class is the same as the QTabWidget but with additional methods to temporarily hide/...
Definition: qgstabwidget.h:27