1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2016 The Qt Company Ltd. 4 ** Contact: https://www.qt.io/licensing/ 5 ** 6 ** This file is part of the Qt Data Visualization module of the Qt Toolkit. 7 ** 8 ** $QT_BEGIN_LICENSE:GPL$ 9 ** Commercial License Usage 10 ** Licensees holding valid commercial Qt licenses may use this file in 11 ** accordance with the commercial license agreement provided with the 12 ** Software or, alternatively, in accordance with the terms contained in 13 ** a written agreement between you and The Qt Company. For licensing terms 14 ** and conditions see https://www.qt.io/terms-conditions. For further 15 ** information use the contact form at https://www.qt.io/contact-us. 16 ** 17 ** GNU General Public License Usage 18 ** Alternatively, this file may be used under the terms of the GNU 19 ** General Public License version 3 or (at your option) any later version 20 ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 ** included in the packaging of this file. Please review the following 23 ** information to ensure the GNU General Public License requirements will 24 ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 ** 26 ** $QT_END_LICENSE$ 27 ** 28 ****************************************************************************/ 29 30 // 31 // W A R N I N G 32 // ------------- 33 // 34 // This file is not part of the QtDataVisualization API. It exists purely as an 35 // implementation detail. This header file may change from version to 36 // version without notice, or even be removed. 37 // 38 // We mean it. 39 40 #ifndef Q3DTHEME_P_H 41 #define Q3DTHEME_P_H 42 43 #include "datavisualizationglobal_p.h" 44 #include "q3dtheme.h" 45 46 QT_BEGIN_NAMESPACE_DATAVISUALIZATION 47 48 struct Q3DThemeDirtyBitField { 49 bool baseColorDirty : 1; 50 bool backgroundColorDirty : 1; 51 bool windowColorDirty : 1; 52 bool labelTextColorDirty : 1; 53 bool labelBackgroundColorDirty : 1; 54 bool gridLineColorDirty : 1; 55 bool singleHighlightColorDirty : 1; 56 bool multiHighlightColorDirty : 1; 57 bool lightColorDirty : 1; 58 bool baseGradientDirty : 1; 59 bool singleHighlightGradientDirty : 1; 60 bool multiHighlightGradientDirty : 1; 61 bool lightStrengthDirty : 1; 62 bool ambientLightStrengthDirty : 1; 63 bool highlightLightStrengthDirty : 1; 64 bool labelBorderEnabledDirty : 1; 65 bool colorStyleDirty : 1; 66 bool fontDirty : 1; 67 bool backgroundEnabledDirty : 1; 68 bool gridEnabledDirty : 1; 69 bool labelBackgroundEnabledDirty : 1; 70 bool themeIdDirty : 1; 71 Q3DThemeDirtyBitFieldQ3DThemeDirtyBitField72 Q3DThemeDirtyBitField() 73 : baseColorDirty(false), 74 backgroundColorDirty(false), 75 windowColorDirty(false), 76 labelTextColorDirty(false), 77 labelBackgroundColorDirty(false), 78 gridLineColorDirty(false), 79 singleHighlightColorDirty(false), 80 multiHighlightColorDirty(false), 81 lightColorDirty(false), 82 baseGradientDirty(false), 83 singleHighlightGradientDirty(false), 84 multiHighlightGradientDirty(false), 85 lightStrengthDirty(false), 86 ambientLightStrengthDirty(false), 87 highlightLightStrengthDirty(false), 88 labelBorderEnabledDirty(false), 89 colorStyleDirty(false), 90 fontDirty(false), 91 backgroundEnabledDirty(false), 92 gridEnabledDirty(false), 93 labelBackgroundEnabledDirty(false), 94 themeIdDirty(false) 95 { 96 } 97 }; 98 99 class QT_DATAVISUALIZATION_EXPORT Q3DThemePrivate : public QObject 100 { 101 Q_OBJECT 102 public: 103 Q3DThemePrivate(Q3DTheme *q); 104 virtual ~Q3DThemePrivate(); 105 106 void resetDirtyBits(); 107 108 bool sync(Q3DThemePrivate &other); 109 isDefaultTheme()110 inline bool isDefaultTheme() { return m_isDefaultTheme; } setDefaultTheme(bool isDefault)111 inline void setDefaultTheme(bool isDefault) { m_isDefaultTheme = isDefault; } 112 113 // If m_forcePredefinedType is true, it means we should forcibly update all properties 114 // of the theme to those of the predefined theme, when setting the theme type. Otherwise 115 // we only change the properties that haven't been explicitly changed since last render cycle. 116 // Defaults to true, and is only ever set to false by DeclarativeTheme3D to enable using 117 // predefined themes as base for custom themes, since the order of initial property sets cannot 118 // be easily controlled in QML. isForcePredefinedType()119 inline bool isForcePredefinedType() { return m_forcePredefinedType; } setForcePredefinedType(bool enable)120 inline void setForcePredefinedType(bool enable) { m_forcePredefinedType = enable; } 121 122 Q_SIGNALS: 123 void needRender(); 124 125 public: 126 Q3DTheme::Theme m_themeId; 127 128 Q3DThemeDirtyBitField m_dirtyBits; 129 130 QList<QColor> m_baseColors; 131 QColor m_backgroundColor; 132 QColor m_windowColor; 133 QColor m_textColor; 134 QColor m_textBackgroundColor; 135 QColor m_gridLineColor; 136 QColor m_singleHighlightColor; 137 QColor m_multiHighlightColor; 138 QColor m_lightColor; 139 QList<QLinearGradient> m_baseGradients; 140 QLinearGradient m_singleHighlightGradient; 141 QLinearGradient m_multiHighlightGradient; 142 float m_lightStrength; 143 float m_ambientLightStrength; 144 float m_highlightLightStrength; 145 bool m_labelBorders; 146 Q3DTheme::ColorStyle m_colorStyle; 147 QFont m_font; 148 bool m_backgoundEnabled; 149 bool m_gridEnabled; 150 bool m_labelBackground; 151 bool m_isDefaultTheme; 152 bool m_forcePredefinedType; 153 154 protected: 155 Q3DTheme *q_ptr; 156 }; 157 158 QT_END_NAMESPACE_DATAVISUALIZATION 159 160 #endif 161