Version: 9.16.0
Style_Model.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20// File : Style_Model.h
21// Author : Vadim SANDLER, Open CASCADE S.A.S (vadim.sandler@opencascade.com)
22//
23#ifndef STYLE_MODEL_H
24#define STYLE_MODEL_H
25
26#include "Style.h"
27
28#include <QMap>
29#include <QString>
30#include <QPalette>
31#include <QFont>
32
33class QStyle;
34class QtxResourceMgr;
35
36//
37// This class is private for Style package.
38// Normally it should not be exported.
39//
41{
42public:
44 typedef enum {
45 WindowText = QPalette::WindowText,
46 Button = QPalette::Button,
47 Light = QPalette::Light,
48 Midlight = QPalette::Midlight,
49 Dark = QPalette::Dark,
50 Mid = QPalette::Mid,
51 Text = QPalette::Text,
52 BrightText = QPalette::BrightText,
53 ButtonText = QPalette::ButtonText,
54 Base = QPalette::Base,
56 Shadow = QPalette::Shadow,
57 Highlight = QPalette::Highlight,
58 HighlightedText = QPalette::HighlightedText,
59 Link = QPalette::Link,
60 LinkVisited = QPalette::LinkVisited,
61 AlternateBase = QPalette::AlternateBase,
62 NoRole = QPalette::NoRole,
63 ToolTipBase = QPalette::ToolTipBase,
64 ToolTipText = QPalette::ToolTipText,
65 NColorRoles = QPalette::NColorRoles,
66 BorderTop = NColorRoles,
81 LastColor
82 } ColorRole;
83
85 typedef enum {
89 } LineType;
90
92 typedef enum {
97 } WidgetRounding;
98
100 typedef enum {
103 AutoRaiseEffect
104 } WidgetEffect;
105
106 Style_Model();
107 virtual ~Style_Model();
108
109 void fromApplication( bool = false );
110 void fromResources( QtxResourceMgr*, const QString& = QString() );
111
112 void save( QtxResourceMgr* = 0, const QString& = QString() );
113 void update();
114 void restore();
115
116 QtxResourceMgr* resourceMgr() const;
117 QString resourceSection() const;
118
119
120 QColor color( ColorRole, QPalette::ColorGroup = QPalette::Active ) const;
121 void setColor( ColorRole, const QColor&, const QColor& = QColor(), const QColor& = QColor() );
122 void setColor( ColorRole, QPalette::ColorGroup, const QColor& );
123
124 bool isAutoPalette() const;
125 void setAutoPalette( bool );
126
127 LineType linesType() const;
128 void setLinesType( LineType );
129
130 int linesTransparency() const;
131 void setLinesTransparency( int );
132
133 QFont applicationFont() const;
134 void setApplicationFont( const QFont& );
135
136 double widgetRounding( WidgetRounding ) const;
137 void setWidgetRounding( WidgetRounding, double );
138
139 bool antialiasing() const;
140 void setAntialiasing( bool );
141
142 WidgetEffect widgetEffect() const;
143 void setWidgetEffect( WidgetEffect );
144
145 int handleDelta( Qt::Orientation ) const;
146 void setHandleDelta( Qt::Orientation, int );
147
148 int splitHandleLength() const;
149 void setSplitHandleLength( int );
150
151 int sliderSize() const;
152 void setSliderSize( int );
153
154private:
155 void initDefaults();
156 void readColorValue( ColorRole, const QString& );
157 void writeColorValue( ColorRole, const QString&, QtxResourceMgr*, const QString& ) const;
158
159private:
160 typedef QMap<ColorRole, QColor> ColorMap;
161 typedef QMap<QPalette::ColorGroup, ColorMap> ColorGroupMap;
162 typedef QMap<WidgetRounding, double> RoundMap;
163 typedef QMap<Qt::Orientation, int> DeltaMap;
164
167
172 QFont myFont;
179
180 struct AppData {
181 QStyle* myStyle;
182 QPalette myPalette;
183 QFont myFont;
184 };
185
187};
188
189#endif // STYLE_MODEL_H
Orientation
Orientation.
Definition: SalomePyQt.h:147
@ Window
Definition: SalomePyQt.h:94
#define STYLE_SALOME_EXPORT
Definition: Style.h:33
Application resources manager.
Definition: QtxResourceMgr.h:53
SALOME style model.
Definition: Style_Model.h:41
LineType myLinesType
Definition: Style_Model.h:173
RoundMap myWidgetRounding
Definition: Style_Model.h:170
@ Checked
Check box indicator color.
Definition: Style_Model.h:79
@ TabBorderBottom
Used to draw bottom-right borders of the tab panels.
Definition: Style_Model.h:69
@ Header
Used to draw header of tab panels.
Definition: Style_Model.h:76
@ Slider
Used to draw sliders.
Definition: Style_Model.h:72
@ Pointer
Used to draw different widgets indicators like spin box arrows etc.
Definition: Style_Model.h:78
@ TabBorderTop
Used to draw top-left borders of the tab panels.
Definition: Style_Model.h:68
@ FieldDark
Dark component of the text entry widgets.
Definition: Style_Model.h:71
@ HighlightWidget
Used to draw widget background when widget is hovered.
Definition: Style_Model.h:74
@ FieldLight
Light component of the text entry widgets.
Definition: Style_Model.h:70
@ HighlightBorder
Used to draw widget borders when widget is hovered.
Definition: Style_Model.h:75
@ Lines
Used to draw lines throughout all the widgets.
Definition: Style_Model.h:73
@ GridLine
Used to draw table widgets grid.
Definition: Style_Model.h:80
@ ProgressBar
Main progress bar color.
Definition: Style_Model.h:77
@ BorderBottom
Used to draw bottom-right borders of the widgets.
Definition: Style_Model.h:67
WidgetEffect
Widget effect.
Definition: Style_Model.h:100
@ HighlightEffect
Highlight widget when it is hovered.
Definition: Style_Model.h:102
@ NoEffect
Do not use widget effects.
Definition: Style_Model.h:101
@ EditRadius
Text entry widgets rounding.
Definition: Style_Model.h:94
@ SliderRadius
Sliders rounding.
Definition: Style_Model.h:96
@ ButtonRadius
Buttons rounding.
Definition: Style_Model.h:93
@ FrameRadius
Frames rounding.
Definition: Style_Model.h:95
QFont myFont
Definition: Style_Model.h:172
int mySliderSize
Definition: Style_Model.h:178
bool myAutoPalette
Definition: Style_Model.h:169
QMap< Qt::Orientation, int > DeltaMap
Definition: Style_Model.h:163
QtxResourceMgr * myResourceMgr
Definition: Style_Model.h:165
QString myResourceSection
Definition: Style_Model.h:166
QMap< ColorRole, QColor > ColorMap
Definition: Style_Model.h:160
QMap< WidgetRounding, double > RoundMap
Definition: Style_Model.h:162
bool myAntiAliasing
Definition: Style_Model.h:175
int mySplitHandleLength
Definition: Style_Model.h:177
LineType
Lines type.
Definition: Style_Model.h:85
@ Horizontal
Draw horozontal lines.
Definition: Style_Model.h:87
@ NoLines
Do not draw lines.
Definition: Style_Model.h:86
@ Inclined
Draw inclined lines.
Definition: Style_Model.h:88
DeltaMap myHandleDelta
Definition: Style_Model.h:171
int myLinesTransparency
Definition: Style_Model.h:176
QMap< QPalette::ColorGroup, ColorMap > ColorGroupMap
Definition: Style_Model.h:161
WidgetEffect myWidgetEffect
Definition: Style_Model.h:174
ColorGroupMap myColors
Definition: Style_Model.h:168
static AppData * myAppData
Application style data.
Definition: Style_Model.h:186
Quantity_Color color(const QColor &)
Convert QColor object to Quantity_Color object.
Definition: OCCViewer.cxx:28
LineType
Definition: Plot2d.h:86
Definition: Style_Model.h:180
QStyle * myStyle
Definition: Style_Model.h:181
QFont myFont
Definition: Style_Model.h:183
QPalette myPalette
Definition: Style_Model.h:182