QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 #include "qgstabbarproxystyle.h"
22 
23 #include "qgis_gui.h"
24 
32 class GUI_EXPORT QgsTabWidget : public QTabWidget
33 {
34  Q_OBJECT
35 
36  public:
37 
43  QgsTabWidget( QWidget *parent = nullptr );
44 
50  void hideTab( QWidget *tab );
51 
57  void showTab( QWidget *tab );
58 
64  void setTabVisible( QWidget *tab, bool visible );
65 
73  int realTabIndex( QWidget *widget );
74 
82  void tabInserted( int index ) override;
83 
91  void tabRemoved( int index ) override;
92 
97  void setTabStyle( int tabIndex, const QgsAttributeEditorElement::LabelStyle &labelStyle );
98 
99  private:
100  void synchronizeIndexes();
101 
102  struct TabInformation
103  {
104  TabInformation( QWidget *wdg, const QString &lbl )
105  : widget( wdg )
106  , label( lbl )
107  {}
108 
110  TabInformation() = default;
111 
112  bool operator ==( const TabInformation &other ) const;
113  bool operator !=( const TabInformation &other ) const;
114 
115  int sourceIndex = -1;
116  QWidget *widget = nullptr;
117  QString label;
118  bool visible = true;
119  };
120 
121  TabInformation tabInfo( QWidget *widget );
122 
123  QList<TabInformation> mTabs;
124  bool mSetTabVisibleFlag = false;
125  QgsTabBarProxyStyle *mTabBarStyle = nullptr;
126 };
127 
128 #endif // QGSTABWIDGET_H
operator==
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Definition: qgsfeatureiterator.h:425
QgsAttributeEditorElement::LabelStyle
The TabStyle struct defines color and font overrides for form fields, tabs and groups labels.
Definition: qgsattributeeditorelement.h:82
operator!=
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Definition: qgsfeatureiterator.h:430
qgstabbarproxystyle.h
QgsTabWidget
The QgsTabWidget class is the same as the QTabWidget but with additional methods to temporarily hide/...
Definition: qgstabwidget.h:32
qgsattributeeditorelement.h