QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgstabbarproxystyle.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstabbarproxystyle.h - QgsTabBarProxyStyle
3  ---------------------
4  begin : 25.3.2022
5  copyright : (C) 2022 by Alessandro Pasotti
6  email : elpaso at itopen dot it
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSTABBARPROXYSTYLE_H
16 #define QGSTABBARPROXYSTYLE_H
17 
18 #include "qgsproxystyle.h"
20 
21 #include <QProxyStyle>
22 #include <QFont>
23 #include <QColor>
24 #include <QMap>
25 #include <QTabBar>
26 
27 #define SIP_NO_FILE
28 
29 #include "qgis_gui.h"
30 
32 
37 class GUI_EXPORT QgsTabBarProxyStyle : public QgsProxyStyle
38 {
39  public:
40 
41  QgsTabBarProxyStyle( QTabBar *tabBar );
42 
43  void drawControl( ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget ) const override;
44 
45  void addStyle( int tabIndex, const QgsAttributeEditorElement::LabelStyle &style );
46 
47  const QMap<int, QgsAttributeEditorElement::LabelStyle> &tabStyles() const;
48 
49  private:
50 
51  QMap<int, QgsAttributeEditorElement::LabelStyle> mTabStyles;
52 
53 };
54 
55 
56 
61 class QgsTabBar: public QTabBar
62 {
63  Q_OBJECT
64 
65  public:
66 
70  QgsTabBar( QWidget *parent );
71 
75  void setTabBarStyle( QgsTabBarProxyStyle *tabStyle );
76 
77  protected:
78 
79  QSize tabSizeHint( int index ) const;
80 
81  private:
82  QgsTabBarProxyStyle *mTabBarStyle = nullptr;
83 
84 };
85 
87 
88 #endif // QGSTABBARPROXYSTYLE_H
qgsproxystyle.h
QgsAttributeEditorElement::LabelStyle
The TabStyle struct defines color and font overrides for form fields, tabs and groups labels.
Definition: qgsattributeeditorelement.h:82
qgsattributeeditorelement.h
QgsProxyStyle
A QProxyStyle subclass which correctly sets the base style to match the QGIS application style,...
Definition: qgsproxystyle.h:30