QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
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 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 QMap<int, QgsAttributeEditorElement::LabelStyle> mTabStyles;
51};
52
53
58class QgsTabBar : public QTabBar
59{
60 Q_OBJECT
61
62 public:
66 QgsTabBar( QWidget *parent );
67
71 void setTabBarStyle( QgsTabBarProxyStyle *tabStyle );
72
73 protected:
74 QSize tabSizeHint( int index ) const;
75
76 private:
77 QgsTabBarProxyStyle *mTabBarStyle = nullptr;
78};
79
81
82#endif // QGSTABBARPROXYSTYLE_H
A QProxyStyle subclass which correctly sets the base style to match the QGIS application style,...
The TabStyle struct defines color and font overrides for form fields, tabs and groups labels.