QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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
37class GUI_EXPORT QgsTabBarProxyStyle : public QgsProxyStyle
38{
39 Q_OBJECT
40 public:
41
42 QgsTabBarProxyStyle( QTabBar *tabBar );
43
44 void drawControl( ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget ) const override;
45
46 void addStyle( int tabIndex, const QgsAttributeEditorElement::LabelStyle &style );
47
48 const QMap<int, QgsAttributeEditorElement::LabelStyle> &tabStyles() const;
49
50 private:
51
52 QMap<int, QgsAttributeEditorElement::LabelStyle> mTabStyles;
53
54};
55
56
57
62class QgsTabBar: public QTabBar
63{
64 Q_OBJECT
65
66 public:
67
71 QgsTabBar( QWidget *parent );
72
76 void setTabBarStyle( QgsTabBarProxyStyle *tabStyle );
77
78 protected:
79
80 QSize tabSizeHint( int index ) const;
81
82 private:
83 QgsTabBarProxyStyle *mTabBarStyle = nullptr;
84
85};
86
88
89#endif // QGSTABBARPROXYSTYLE_H
A QProxyStyle subclass which correctly sets the base style to match the QGIS application style,...
Definition: qgsproxystyle.h:31
The TabStyle struct defines color and font overrides for form fields, tabs and groups labels.