| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #include "q3dtheme_p.h" |
| 5 | #include "thememanager_p.h" |
| 6 | |
| 7 | QT_BEGIN_NAMESPACE |
| 8 | |
| 9 | /*! |
| 10 | * \class Q3DTheme |
| 11 | * \inmodule QtDataVisualization |
| 12 | * \brief Q3DTheme class provides a visual style for graphs. |
| 13 | * \since QtDataVisualization 1.0 |
| 14 | * |
| 15 | * Specifies visual properties that affect the whole graph. There are several |
| 16 | * built-in themes that can be used as is or modified freely. |
| 17 | * |
| 18 | * The following properties can be overridden by using QAbstract3DSeries |
| 19 | * properties to set them explicitly in the series: baseColors, baseGradients, |
| 20 | * and colorStyle. |
| 21 | * |
| 22 | * Themes can be created from scratch using the ThemeUserDefined enum value. |
| 23 | * Creating a theme using the default constructor produces a new user-defined |
| 24 | * theme. |
| 25 | * |
| 26 | * \section1 Default Theme |
| 27 | * |
| 28 | * The following table lists the properties controlled by themes and the |
| 29 | * default values for ThemeUserDefined. |
| 30 | * |
| 31 | * \table |
| 32 | * \header |
| 33 | * \li Property |
| 34 | * \li Default Value |
| 35 | * \row |
| 36 | * \li ambientLightStrength |
| 37 | * \li 0.25 |
| 38 | * \row |
| 39 | * \li backgroundColor |
| 40 | * \li Qt::black |
| 41 | * \row |
| 42 | * \li backgroundEnabled |
| 43 | * \li \c true |
| 44 | * \row |
| 45 | * \li baseColors |
| 46 | * \li Qt::black |
| 47 | * \row |
| 48 | * \li baseGradients |
| 49 | * \li QLinearGradient. Essentially fully black. |
| 50 | * \row |
| 51 | * \li colorStyle |
| 52 | * \li ColorStyleUniform |
| 53 | * \row |
| 54 | * \li \l font |
| 55 | * \li QFont |
| 56 | * \row |
| 57 | * \li gridEnabled |
| 58 | * \li \c true |
| 59 | * \row |
| 60 | * \li gridLineColor |
| 61 | * \li Qt::white |
| 62 | * \row |
| 63 | * \li highlightLightStrength |
| 64 | * \li 7.5 |
| 65 | * \row |
| 66 | * \li labelBackgroundColor |
| 67 | * \li Qt::gray |
| 68 | * \row |
| 69 | * \li labelBackgroundEnabled |
| 70 | * \li \c true |
| 71 | * \row |
| 72 | * \li labelBorderEnabled |
| 73 | * \li \c true |
| 74 | * \row |
| 75 | * \li labelTextColor |
| 76 | * \li Qt::white |
| 77 | * \row |
| 78 | * \li lightColor |
| 79 | * \li Qt::white |
| 80 | * \row |
| 81 | * \li lightStrength |
| 82 | * \li 5.0 |
| 83 | * \row |
| 84 | * \li multiHighlightColor |
| 85 | * \li Qt::blue |
| 86 | * \row |
| 87 | * \li multiHighlightGradient |
| 88 | * \li QLinearGradient. Essentially fully black. |
| 89 | * \row |
| 90 | * \li singleHighlightColor |
| 91 | * \li Qt::red |
| 92 | * \row |
| 93 | * \li singleHighlightGradient |
| 94 | * \li QLinearGradient. Essentially fully black. |
| 95 | * \row |
| 96 | * \li windowColor |
| 97 | * \li Qt::black |
| 98 | * \endtable |
| 99 | * |
| 100 | * \section1 Usage Examples |
| 101 | * |
| 102 | * Creating a built-in theme without any modifications: |
| 103 | * |
| 104 | * \snippet doc_src_q3dtheme.cpp 0 |
| 105 | * |
| 106 | * Creating a built-in theme and modifying some properties: |
| 107 | * |
| 108 | * \snippet doc_src_q3dtheme.cpp 1 |
| 109 | * |
| 110 | * Creating a user-defined theme: |
| 111 | * |
| 112 | * \snippet doc_src_q3dtheme.cpp 2 |
| 113 | * |
| 114 | * Creating a built-in theme and modifying some properties after it has been set: |
| 115 | * |
| 116 | * \snippet doc_src_q3dtheme.cpp 3 |
| 117 | * |
| 118 | */ |
| 119 | |
| 120 | /*! |
| 121 | * \enum Q3DTheme::ColorStyle |
| 122 | * |
| 123 | * Color styles. |
| 124 | * |
| 125 | * \value ColorStyleUniform |
| 126 | * Objects are rendered in a single color. The color used is specified in baseColors, |
| 127 | * singleHighlightColor and multiHighlightColor properties. |
| 128 | * \value ColorStyleObjectGradient |
| 129 | * Objects are colored using a full gradient for each object regardless of object height. The |
| 130 | * gradient used is specified in baseGradients, singleHighlightGradient and |
| 131 | * multiHighlightGradient properties. |
| 132 | * \value ColorStyleRangeGradient |
| 133 | * Objects are colored using a portion of the full gradient determined by the object's |
| 134 | * height and its position on the Y-axis. The gradient used is specified in baseGradients, |
| 135 | * singleHighlightGradient and multiHighlightGradient properties. |
| 136 | */ |
| 137 | |
| 138 | /*! |
| 139 | * \enum Q3DTheme::Theme |
| 140 | * |
| 141 | * Built-in themes. |
| 142 | * |
| 143 | * \value ThemeQt |
| 144 | * A light theme with green as the base color. |
| 145 | * \value ThemePrimaryColors |
| 146 | * A light theme with yellow as the base color. |
| 147 | * \value ThemeDigia |
| 148 | * A light theme with gray as the base color. |
| 149 | * \value ThemeStoneMoss |
| 150 | * A medium dark theme with yellow as the base color. |
| 151 | * \value ThemeArmyBlue |
| 152 | * A medium light theme with blue as the base color. |
| 153 | * \value ThemeRetro |
| 154 | * A medium light theme with brown as the base color. |
| 155 | * \value ThemeEbony |
| 156 | * A dark theme with white as the base color. |
| 157 | * \value ThemeIsabelle |
| 158 | * A dark theme with yellow as the base color. |
| 159 | * \value ThemeUserDefined |
| 160 | * A user-defined theme. For more information, see \l {Default Theme}. |
| 161 | */ |
| 162 | |
| 163 | /*! |
| 164 | * \qmltype Theme3D |
| 165 | * \inqmlmodule QtDataVisualization |
| 166 | * \since QtDataVisualization 1.0 |
| 167 | * \ingroup datavisualization_qml |
| 168 | * \nativetype Q3DTheme |
| 169 | * \brief A visual style for graphs. |
| 170 | * |
| 171 | * This type is used to specify visual properties that affect the whole graph. There are several |
| 172 | * built-in themes that can be used as is or modified freely. |
| 173 | * |
| 174 | * The following properties can be overridden by using Abstract3DSeries |
| 175 | * properties to set them explicitly in the series: |
| 176 | * baseColors, baseGradients, and colorStyle. |
| 177 | * |
| 178 | * Themes can be created from scratch by using the |
| 179 | * \l{Q3DTheme::ThemeUserDefined}{Theme3D.ThemeUserDefined} enum value. |
| 180 | * |
| 181 | * \section1 Default Theme |
| 182 | * |
| 183 | * The following table lists the properties controlled by themes and the |
| 184 | * default values for \l{Q3DTheme::ThemeUserDefined} |
| 185 | * {Theme3D.ThemeUserDefined}. |
| 186 | * |
| 187 | * \table |
| 188 | * \header |
| 189 | * \li Property |
| 190 | * \li Default Value |
| 191 | * \row |
| 192 | * \li ambientLightStrength |
| 193 | * \li 0.25 |
| 194 | * \row |
| 195 | * \li backgroundColor |
| 196 | * \li "black". For more information, see \l [QtQuick] color. |
| 197 | * \row |
| 198 | * \li backgroundEnabled |
| 199 | * \li \c true |
| 200 | * \row |
| 201 | * \li baseColors |
| 202 | * \li "black" |
| 203 | * \row |
| 204 | * \li baseGradients |
| 205 | * \li QLinearGradient. Essentially fully black. |
| 206 | * \row |
| 207 | * \li colorStyle |
| 208 | * \li ColorStyleUniform |
| 209 | * \row |
| 210 | * \li \l font |
| 211 | * \li \l [QtQuick] font |
| 212 | * \row |
| 213 | * \li gridEnabled |
| 214 | * \li \c true |
| 215 | * \row |
| 216 | * \li gridLineColor |
| 217 | * \li "white" |
| 218 | * \row |
| 219 | * \li highlightLightStrength |
| 220 | * \li 7.5 |
| 221 | * \row |
| 222 | * \li labelBackgroundColor |
| 223 | * \li "gray" |
| 224 | * \row |
| 225 | * \li labelBackgroundEnabled |
| 226 | * \li \c true |
| 227 | * \row |
| 228 | * \li labelBorderEnabled |
| 229 | * \li \c true |
| 230 | * \row |
| 231 | * \li labelTextColor |
| 232 | * \li "white" |
| 233 | * \row |
| 234 | * \li lightColor |
| 235 | * \li "white" |
| 236 | * \row |
| 237 | * \li lightStrength |
| 238 | * \li 5.0 |
| 239 | * \row |
| 240 | * \li multiHighlightColor |
| 241 | * \li "blue" |
| 242 | * \row |
| 243 | * \li multiHighlightGradient |
| 244 | * \li QLinearGradient. Essentially fully black. |
| 245 | * \row |
| 246 | * \li singleHighlightColor |
| 247 | * \li "red" |
| 248 | * \row |
| 249 | * \li singleHighlightGradient |
| 250 | * \li QLinearGradient. Essentially fully black. |
| 251 | * \row |
| 252 | * \li windowColor |
| 253 | * \li "black" |
| 254 | * \endtable |
| 255 | * |
| 256 | * \section1 Usage examples |
| 257 | * |
| 258 | * Using a built-in theme without any modifications: |
| 259 | * |
| 260 | * \snippet doc_src_q3dtheme.cpp 4 |
| 261 | * |
| 262 | * Using a built-in theme and modifying some properties: |
| 263 | * |
| 264 | * \snippet doc_src_q3dtheme.cpp 5 |
| 265 | * |
| 266 | * Using a user-defined theme: |
| 267 | * |
| 268 | * \snippet doc_src_q3dtheme.cpp 6 |
| 269 | * |
| 270 | * For Theme3D enums, see \l Q3DTheme::ColorStyle and \l{Q3DTheme::Theme}. |
| 271 | */ |
| 272 | |
| 273 | /*! |
| 274 | * \qmlproperty list<ThemeColor> Theme3D::baseColors |
| 275 | * |
| 276 | * The list of base colors to be used for all the objects in the graph, series by series. If there |
| 277 | * are more series than colors, color list wraps and starts again with the first color in the list. |
| 278 | * Has no immediate effect if colorStyle is not \c Theme3D.ColorStyleUniform. |
| 279 | * |
| 280 | * This can be overridden by setting \l{Abstract3DSeries::baseColor} |
| 281 | * {Abstract3DSeries.baseColor} explicitly in the series. |
| 282 | */ |
| 283 | |
| 284 | /*! |
| 285 | * \qmlproperty color Theme3D::backgroundColor |
| 286 | * |
| 287 | * The color of the graph background. |
| 288 | */ |
| 289 | |
| 290 | /*! |
| 291 | * \qmlproperty color Theme3D::windowColor |
| 292 | * |
| 293 | * The color of the application window the graph is drawn into. |
| 294 | */ |
| 295 | |
| 296 | /*! |
| 297 | * \qmlproperty color Theme3D::labelTextColor |
| 298 | * |
| 299 | * The color of the font used for labels. |
| 300 | */ |
| 301 | |
| 302 | /*! |
| 303 | * \qmlproperty color Theme3D::labelBackgroundColor |
| 304 | * |
| 305 | * The color of the label backgrounds. Has no effect if labelBackgroundEnabled is \c false. |
| 306 | */ |
| 307 | |
| 308 | /*! |
| 309 | * \qmlproperty color Theme3D::gridLineColor |
| 310 | * |
| 311 | * The color of the grid lines. |
| 312 | * |
| 313 | * \note Transparency is not supported and will result in undefined behavior. |
| 314 | */ |
| 315 | |
| 316 | /*! |
| 317 | * \qmlproperty color Theme3D::singleHighlightColor |
| 318 | * |
| 319 | * The highlight color for a selected object. Used if |
| 320 | * \l{AbstractGraph3D::selectionMode}{selectionMode} |
| 321 | * has the \c AbstractGraph3D.SelectionItem flag set. |
| 322 | * |
| 323 | * \note Transparency is not supported and will result in undefined behavior. |
| 324 | */ |
| 325 | |
| 326 | /*! |
| 327 | * \qmlproperty color Theme3D::multiHighlightColor |
| 328 | * |
| 329 | * The highlight color for selected objects. Used if |
| 330 | * \l{AbstractGraph3D::selectionMode}{selectionMode} |
| 331 | * has the \c AbstractGraph3D.SelectionRow or \c AbstractGraph3D.SelectionColumn |
| 332 | * flag set. |
| 333 | * |
| 334 | * \note Transparency is not supported and will result in undefined behavior. |
| 335 | */ |
| 336 | |
| 337 | /*! |
| 338 | * \qmlproperty color Theme3D::lightColor |
| 339 | * |
| 340 | * The color of the ambient and specular light defined in Scene3D. |
| 341 | */ |
| 342 | |
| 343 | /*! |
| 344 | * \qmlproperty list<ColorGradient> Theme3D::baseGradients |
| 345 | * |
| 346 | * The list of base gradients to be used for all the objects in the graph, |
| 347 | * series by series. If there are more series than gradients, the gradient list |
| 348 | * wraps and starts again with the first gradient in the list. |
| 349 | * |
| 350 | * Has no immediate effect if colorStyle is \l{Q3DTheme::ColorStyleUniform} |
| 351 | * {Theme3D.ColorStyleUniform}. |
| 352 | * |
| 353 | * This value can be overridden by setting \l{Abstract3DSeries::baseGradient} |
| 354 | *{Abstract3DSeries.baseGradient} explicitly in the series. |
| 355 | */ |
| 356 | |
| 357 | /*! |
| 358 | * \qmlproperty ColorGradient Theme3D::singleHighlightGradient |
| 359 | * |
| 360 | * The highlight gradient for a selected object. Used if |
| 361 | * \l{AbstractGraph3D::selectionMode}{selectionMode} |
| 362 | * has the \c AbstractGraph3D.SelectionItem flag set. |
| 363 | * |
| 364 | * \note Transparency is not supported and will result in undefined behavior. |
| 365 | */ |
| 366 | |
| 367 | /*! |
| 368 | * \qmlproperty ColorGradient Theme3D::multiHighlightGradient |
| 369 | * |
| 370 | * The highlight gradient for selected objects. Used if |
| 371 | * \l{AbstractGraph3D::selectionMode}{selectionMode} |
| 372 | * has the \c AbstractGraph3D.SelectionRow or \c AbstractGraph3D.SelectionColumn |
| 373 | * flag set. |
| 374 | * |
| 375 | * \note Transparency is not supported and will result in undefined behavior. |
| 376 | */ |
| 377 | |
| 378 | /*! |
| 379 | * \qmlproperty real Theme3D::lightStrength |
| 380 | * |
| 381 | * The specular light strength for the whole graph. The value must be between |
| 382 | * \c 0.0 and \c 10.0. |
| 383 | * |
| 384 | * This value affects the light specified in Scene3D. |
| 385 | */ |
| 386 | |
| 387 | /*! |
| 388 | * \qmlproperty real Theme3D::ambientLightStrength |
| 389 | * |
| 390 | * The ambient light strength for the whole graph. This value determines how |
| 391 | * evenly and brightly the colors are shown throughout the graph regardless of |
| 392 | * the light position. The value must be between \c 0.0 and \c 1.0. |
| 393 | */ |
| 394 | |
| 395 | /*! |
| 396 | * \qmlproperty real Theme3D::highlightLightStrength |
| 397 | * |
| 398 | * The specular light strength for selected objects. The value must be |
| 399 | * between \c 0.0 and \c 10.0. |
| 400 | */ |
| 401 | |
| 402 | /*! |
| 403 | * \qmlproperty bool Theme3D::labelBorderEnabled |
| 404 | * |
| 405 | * Defines whether label borders are drawn for labels that have a background. |
| 406 | * Has no effect if labelBackgroundEnabled is \c false. |
| 407 | */ |
| 408 | |
| 409 | /*! |
| 410 | * \qmlproperty font Theme3D::font |
| 411 | * |
| 412 | * Sets the font to be used for labels. |
| 413 | */ |
| 414 | |
| 415 | /*! |
| 416 | * \qmlproperty bool Theme3D::backgroundEnabled |
| 417 | * |
| 418 | * Defines whether the background is drawn by using the value of |
| 419 | * backgroundColor. |
| 420 | */ |
| 421 | |
| 422 | /*! |
| 423 | * \qmlproperty bool Theme3D::gridEnabled |
| 424 | * |
| 425 | * Defines whether the grid lines are drawn. This value affects all grid lines. |
| 426 | */ |
| 427 | |
| 428 | /*! |
| 429 | * \qmlproperty bool Theme3D::labelBackgroundEnabled |
| 430 | * |
| 431 | * Defines whether the label is drawn with a background that uses |
| 432 | * labelBackgroundColor (including alpha), or with a fully transparent |
| 433 | * background. Labels with a background are drawn to equal sizes per axis based |
| 434 | * on the longest label, and the text is centered in them. Labels without |
| 435 | * a background are drawn as is and are left or right aligned based on their |
| 436 | * position in the graph. |
| 437 | */ |
| 438 | |
| 439 | /*! |
| 440 | * \qmlproperty Theme3D.ColorStyle Theme3D::colorStyle |
| 441 | * |
| 442 | * The style of the graph colors. One of Q3DTheme::ColorStyle enum values. |
| 443 | * |
| 444 | * This value can be overridden by setting \l{Abstract3DSeries::colorStyle} |
| 445 | * {Abstract3DSeries.colorStyle} explicitly in the series. |
| 446 | * |
| 447 | * \sa Q3DTheme::ColorStyle |
| 448 | */ |
| 449 | |
| 450 | /*! |
| 451 | * \qmlproperty Theme3D.Theme Theme3D::type |
| 452 | * |
| 453 | * The type of the theme. If no type is set, the type is |
| 454 | * \l{Q3DTheme::ThemeUserDefined}{Theme3D.ThemeUserDefined}. |
| 455 | * Changing the theme type after the item has been constructed will change all other properties |
| 456 | * of the theme to what the predefined theme specifies. Changing the theme type of the active theme |
| 457 | * of the graph will also reset all attached series to use the new theme. |
| 458 | */ |
| 459 | |
| 460 | /*! |
| 461 | * Constructs a new theme of type ThemeUserDefined. An optional \a parent parameter |
| 462 | * can be given and is then passed to QObject constructor. |
| 463 | */ |
| 464 | Q3DTheme::Q3DTheme(QObject *parent) |
| 465 | : QObject(parent), |
| 466 | d_ptr(new Q3DThemePrivate(this)) |
| 467 | { |
| 468 | } |
| 469 | |
| 470 | /*! |
| 471 | * Constructs a new theme with \a themeType, which can be one of the built-in themes from |
| 472 | * \l Theme. An optional \a parent parameter can be given and is then passed to QObject |
| 473 | * constructor. |
| 474 | */ |
| 475 | Q3DTheme::Q3DTheme(Theme themeType, QObject *parent) |
| 476 | : QObject(parent), |
| 477 | d_ptr(new Q3DThemePrivate(this)) |
| 478 | { |
| 479 | setType(themeType); |
| 480 | } |
| 481 | |
| 482 | /*! |
| 483 | * \internal |
| 484 | */ |
| 485 | Q3DTheme::Q3DTheme(Q3DThemePrivate *d, Theme themeType, |
| 486 | QObject *parent) : |
| 487 | QObject(parent), |
| 488 | d_ptr(d) |
| 489 | { |
| 490 | setType(themeType); |
| 491 | } |
| 492 | |
| 493 | /*! |
| 494 | * Destroys the theme. |
| 495 | */ |
| 496 | Q3DTheme::~Q3DTheme() |
| 497 | { |
| 498 | } |
| 499 | |
| 500 | /*! |
| 501 | * \property Q3DTheme::baseColors |
| 502 | * |
| 503 | * \brief The list of base colors to be used for all the objects in the graph, |
| 504 | * series by series. |
| 505 | * |
| 506 | * If there are more series than colors, the color list wraps and starts again |
| 507 | * with the first color in the list. |
| 508 | * |
| 509 | * Has no immediate effect if colorStyle is not ColorStyleUniform. |
| 510 | * |
| 511 | * This value can be overridden by setting the \l{QAbstract3DSeries::baseColor} |
| 512 | * {baseColor} explicitly in the series. |
| 513 | */ |
| 514 | void Q3DTheme::setBaseColors(const QList<QColor> &colors) |
| 515 | { |
| 516 | if (colors.size()) { |
| 517 | d_ptr->m_dirtyBits.baseColorDirty = true; |
| 518 | if (d_ptr->m_baseColors != colors) { |
| 519 | d_ptr->m_baseColors.clear(); |
| 520 | d_ptr->m_baseColors = colors; |
| 521 | emit baseColorsChanged(colors); |
| 522 | } |
| 523 | } else { |
| 524 | d_ptr->m_baseColors.clear(); |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | QList<QColor> Q3DTheme::baseColors() const |
| 529 | { |
| 530 | return d_ptr->m_baseColors; |
| 531 | } |
| 532 | |
| 533 | /*! |
| 534 | * \property Q3DTheme::backgroundColor |
| 535 | * |
| 536 | * \brief The color of the graph background. |
| 537 | */ |
| 538 | void Q3DTheme::setBackgroundColor(const QColor &color) |
| 539 | { |
| 540 | d_ptr->m_dirtyBits.backgroundColorDirty = true; |
| 541 | if (d_ptr->m_backgroundColor != color) { |
| 542 | d_ptr->m_backgroundColor = color; |
| 543 | emit backgroundColorChanged(color); |
| 544 | emit d_ptr->needRender(); |
| 545 | } |
| 546 | } |
| 547 | |
| 548 | QColor Q3DTheme::backgroundColor() const |
| 549 | { |
| 550 | return d_ptr->m_backgroundColor; |
| 551 | } |
| 552 | |
| 553 | /*! |
| 554 | * \property Q3DTheme::windowColor |
| 555 | * |
| 556 | * \brief The color of the application window the graph is drawn into. |
| 557 | */ |
| 558 | void Q3DTheme::setWindowColor(const QColor &color) |
| 559 | { |
| 560 | d_ptr->m_dirtyBits.windowColorDirty = true; |
| 561 | if (d_ptr->m_windowColor != color) { |
| 562 | d_ptr->m_windowColor = color; |
| 563 | emit windowColorChanged(color); |
| 564 | emit d_ptr->needRender(); |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | QColor Q3DTheme::windowColor() const |
| 569 | { |
| 570 | return d_ptr->m_windowColor; |
| 571 | } |
| 572 | |
| 573 | /*! |
| 574 | * \property Q3DTheme::labelTextColor |
| 575 | * |
| 576 | * \brief The color of the font used for labels. |
| 577 | */ |
| 578 | void Q3DTheme::setLabelTextColor(const QColor &color) |
| 579 | { |
| 580 | d_ptr->m_dirtyBits.labelTextColorDirty = true; |
| 581 | if (d_ptr->m_textColor != color) { |
| 582 | d_ptr->m_textColor = color; |
| 583 | emit labelTextColorChanged(color); |
| 584 | emit d_ptr->needRender(); |
| 585 | } |
| 586 | } |
| 587 | |
| 588 | QColor Q3DTheme::labelTextColor() const |
| 589 | { |
| 590 | return d_ptr->m_textColor; |
| 591 | } |
| 592 | |
| 593 | /*! |
| 594 | * \property Q3DTheme::labelBackgroundColor |
| 595 | * |
| 596 | * \brief The color of the label backgrounds. |
| 597 | * |
| 598 | * Has no effect if labelBackgroundEnabled is \c false. |
| 599 | */ |
| 600 | void Q3DTheme::setLabelBackgroundColor(const QColor &color) |
| 601 | { |
| 602 | d_ptr->m_dirtyBits.labelBackgroundColorDirty = true; |
| 603 | if (d_ptr->m_textBackgroundColor != color) { |
| 604 | d_ptr->m_textBackgroundColor = color; |
| 605 | emit labelBackgroundColorChanged(color); |
| 606 | emit d_ptr->needRender(); |
| 607 | } |
| 608 | } |
| 609 | |
| 610 | QColor Q3DTheme::labelBackgroundColor() const |
| 611 | { |
| 612 | return d_ptr->m_textBackgroundColor; |
| 613 | } |
| 614 | |
| 615 | /*! |
| 616 | * \property Q3DTheme::gridLineColor |
| 617 | * |
| 618 | * \brief The color of the grid lines. |
| 619 | * |
| 620 | * \note Transparency is not supported and will result in undefined behavior. |
| 621 | */ |
| 622 | void Q3DTheme::setGridLineColor(const QColor &color) |
| 623 | { |
| 624 | d_ptr->m_dirtyBits.gridLineColorDirty = true; |
| 625 | if (d_ptr->m_gridLineColor != color) { |
| 626 | d_ptr->m_gridLineColor = color; |
| 627 | emit gridLineColorChanged(color); |
| 628 | emit d_ptr->needRender(); |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | QColor Q3DTheme::gridLineColor() const |
| 633 | { |
| 634 | return d_ptr->m_gridLineColor; |
| 635 | } |
| 636 | |
| 637 | /*! |
| 638 | * \property Q3DTheme::singleHighlightColor |
| 639 | * |
| 640 | * \brief The highlight color for a selected object. |
| 641 | * |
| 642 | * Used if \l{QAbstract3DGraph::selectionMode}{selectionMode} has the |
| 643 | * \c QAbstract3DGraph::SelectionItem flag set. |
| 644 | */ |
| 645 | void Q3DTheme::setSingleHighlightColor(const QColor &color) |
| 646 | { |
| 647 | d_ptr->m_dirtyBits.singleHighlightColorDirty = true; |
| 648 | if (d_ptr->m_singleHighlightColor != color) { |
| 649 | d_ptr->m_singleHighlightColor = color; |
| 650 | emit singleHighlightColorChanged(color); |
| 651 | } |
| 652 | } |
| 653 | |
| 654 | QColor Q3DTheme::singleHighlightColor() const |
| 655 | { |
| 656 | return d_ptr->m_singleHighlightColor; |
| 657 | } |
| 658 | |
| 659 | /*! |
| 660 | * \property Q3DTheme::multiHighlightColor |
| 661 | * |
| 662 | * \brief The highlight color for selected objects. |
| 663 | * |
| 664 | * Used if \l{QAbstract3DGraph::selectionMode}{selectionMode} has the |
| 665 | * \c QAbstract3DGraph::SelectionRow or \c QAbstract3DGraph::SelectionColumn |
| 666 | * flag set. |
| 667 | */ |
| 668 | void Q3DTheme::setMultiHighlightColor(const QColor &color) |
| 669 | { |
| 670 | d_ptr->m_dirtyBits.multiHighlightColorDirty = true; |
| 671 | if (d_ptr->m_multiHighlightColor != color) { |
| 672 | d_ptr->m_multiHighlightColor = color; |
| 673 | emit multiHighlightColorChanged(color); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | QColor Q3DTheme::multiHighlightColor() const |
| 678 | { |
| 679 | return d_ptr->m_multiHighlightColor; |
| 680 | } |
| 681 | |
| 682 | /*! |
| 683 | * \property Q3DTheme::lightColor |
| 684 | * |
| 685 | * \brief The color for the ambient and specular light. |
| 686 | * |
| 687 | * This value affects the light specified in Q3DScene. |
| 688 | */ |
| 689 | void Q3DTheme::setLightColor(const QColor &color) |
| 690 | { |
| 691 | d_ptr->m_dirtyBits.lightColorDirty = true; |
| 692 | if (d_ptr->m_lightColor != color) { |
| 693 | d_ptr->m_lightColor = color; |
| 694 | emit lightColorChanged(color); |
| 695 | emit d_ptr->needRender(); |
| 696 | } |
| 697 | } |
| 698 | |
| 699 | QColor Q3DTheme::lightColor() const |
| 700 | { |
| 701 | return d_ptr->m_lightColor; |
| 702 | } |
| 703 | |
| 704 | /*! |
| 705 | * \property Q3DTheme::baseGradients |
| 706 | * |
| 707 | * \brief The list of base gradients to be used for all the objects in the |
| 708 | * graph, series by series. |
| 709 | * |
| 710 | * If there are more series than gradients, the gradient list wraps and starts |
| 711 | * again with the first gradient in the list |
| 712 | * |
| 713 | * Has no immediate effect if colorStyle is ColorStyleUniform. |
| 714 | * |
| 715 | * This value can be overridden by setting the |
| 716 | * \l{QAbstract3DSeries::baseGradient}{baseGradient} explicitly in the series. |
| 717 | */ |
| 718 | void Q3DTheme::setBaseGradients(const QList<QLinearGradient> &gradients) |
| 719 | { |
| 720 | if (gradients.size()) { |
| 721 | d_ptr->m_dirtyBits.baseGradientDirty = true; |
| 722 | if (d_ptr->m_baseGradients != gradients) { |
| 723 | d_ptr->m_baseGradients.clear(); |
| 724 | d_ptr->m_baseGradients = gradients; |
| 725 | emit baseGradientsChanged(gradients); |
| 726 | } |
| 727 | } else { |
| 728 | d_ptr->m_baseGradients.clear(); |
| 729 | } |
| 730 | } |
| 731 | |
| 732 | QList<QLinearGradient> Q3DTheme::baseGradients() const |
| 733 | { |
| 734 | return d_ptr->m_baseGradients; |
| 735 | } |
| 736 | |
| 737 | /*! |
| 738 | * \property Q3DTheme::singleHighlightGradient |
| 739 | * |
| 740 | * \brief The highlight gradient for a selected object. |
| 741 | * |
| 742 | * Used if \l{QAbstract3DGraph::selectionMode}{selectionMode} |
| 743 | * has the \c QAbstract3DGraph::SelectionItem flag set. |
| 744 | */ |
| 745 | void Q3DTheme::setSingleHighlightGradient(const QLinearGradient &gradient) |
| 746 | { |
| 747 | d_ptr->m_dirtyBits.singleHighlightGradientDirty = true; |
| 748 | if (d_ptr->m_singleHighlightGradient != gradient) { |
| 749 | d_ptr->m_singleHighlightGradient = gradient; |
| 750 | emit singleHighlightGradientChanged(gradient); |
| 751 | } |
| 752 | } |
| 753 | |
| 754 | QLinearGradient Q3DTheme::singleHighlightGradient() const |
| 755 | { |
| 756 | return d_ptr->m_singleHighlightGradient; |
| 757 | } |
| 758 | |
| 759 | /*! |
| 760 | * \property Q3DTheme::multiHighlightGradient |
| 761 | * |
| 762 | * \brief The highlight gradient for selected objects. |
| 763 | * |
| 764 | * Used if \l{QAbstract3DGraph::selectionMode}{selectionMode} |
| 765 | * has the \c QAbstract3DGraph::SelectionRow or |
| 766 | * \c QAbstract3DGraph::SelectionColumn flag set. |
| 767 | */ |
| 768 | void Q3DTheme::setMultiHighlightGradient(const QLinearGradient &gradient) |
| 769 | { |
| 770 | d_ptr->m_dirtyBits.multiHighlightGradientDirty = true; |
| 771 | if (d_ptr->m_multiHighlightGradient != gradient) { |
| 772 | d_ptr->m_multiHighlightGradient = gradient; |
| 773 | emit multiHighlightGradientChanged(gradient); |
| 774 | } |
| 775 | } |
| 776 | |
| 777 | QLinearGradient Q3DTheme::multiHighlightGradient() const |
| 778 | { |
| 779 | return d_ptr->m_multiHighlightGradient; |
| 780 | } |
| 781 | |
| 782 | /*! |
| 783 | * \property Q3DTheme::lightStrength |
| 784 | * |
| 785 | * \brief The specular light strength for the whole graph. |
| 786 | * |
| 787 | * The value must be between \c 0.0f and \c 10.0f. |
| 788 | * |
| 789 | * This value affects the light specified in Q3DScene. |
| 790 | */ |
| 791 | void Q3DTheme::setLightStrength(float strength) |
| 792 | { |
| 793 | d_ptr->m_dirtyBits.lightStrengthDirty = true; |
| 794 | if (strength < 0.0f || strength > 10.0f) { |
| 795 | qWarning(msg: "Invalid value. Valid range for lightStrength is between 0.0f and 10.0f" ); |
| 796 | } else if (d_ptr->m_lightStrength != strength) { |
| 797 | d_ptr->m_lightStrength = strength; |
| 798 | emit lightStrengthChanged(strength); |
| 799 | emit d_ptr->needRender(); |
| 800 | } |
| 801 | } |
| 802 | |
| 803 | float Q3DTheme::lightStrength() const |
| 804 | { |
| 805 | return d_ptr->m_lightStrength; |
| 806 | } |
| 807 | |
| 808 | /*! |
| 809 | * \property Q3DTheme::ambientLightStrength |
| 810 | * |
| 811 | * \brief The ambient light strength for the whole graph. |
| 812 | * |
| 813 | * This value determines how evenly and brightly the colors are shown throughout |
| 814 | * the graph regardless of the light position. |
| 815 | * |
| 816 | * The value must be between \c 0.0f and \c 1.0f. |
| 817 | */ |
| 818 | void Q3DTheme::setAmbientLightStrength(float strength) |
| 819 | { |
| 820 | d_ptr->m_dirtyBits.ambientLightStrengthDirty = true; |
| 821 | if (strength < 0.0f || strength > 1.0f) { |
| 822 | qWarning(msg: "Invalid value. Valid range for ambientLightStrength is between 0.0f and 1.0f" ); |
| 823 | } else if (d_ptr->m_ambientLightStrength != strength) { |
| 824 | d_ptr->m_ambientLightStrength = strength; |
| 825 | emit ambientLightStrengthChanged(strength); |
| 826 | emit d_ptr->needRender(); |
| 827 | } |
| 828 | } |
| 829 | |
| 830 | float Q3DTheme::ambientLightStrength() const |
| 831 | { |
| 832 | return d_ptr->m_ambientLightStrength; |
| 833 | } |
| 834 | |
| 835 | /*! |
| 836 | * \property Q3DTheme::highlightLightStrength |
| 837 | * |
| 838 | * \brief The specular light strength for selected objects. |
| 839 | * |
| 840 | * The value must be between \c 0.0f and \c 10.0f. |
| 841 | */ |
| 842 | void Q3DTheme::setHighlightLightStrength(float strength) |
| 843 | { |
| 844 | d_ptr->m_dirtyBits.highlightLightStrengthDirty = true; |
| 845 | if (strength < 0.0f || strength > 10.0f) { |
| 846 | qWarning(msg: "Invalid value. Valid range for highlightLightStrength is between 0.0f and 10.0f" ); |
| 847 | } else if (d_ptr->m_highlightLightStrength != strength) { |
| 848 | d_ptr->m_highlightLightStrength = strength; |
| 849 | emit highlightLightStrengthChanged(strength); |
| 850 | emit d_ptr->needRender(); |
| 851 | } |
| 852 | } |
| 853 | |
| 854 | float Q3DTheme::highlightLightStrength() const |
| 855 | { |
| 856 | return d_ptr->m_highlightLightStrength; |
| 857 | } |
| 858 | |
| 859 | /*! |
| 860 | * \property Q3DTheme::labelBorderEnabled |
| 861 | * |
| 862 | * \brief Whether label borders are drawn for labels that have a background. |
| 863 | * |
| 864 | * Has no effect if labelBackgroundEnabled is \c false. |
| 865 | */ |
| 866 | void Q3DTheme::setLabelBorderEnabled(bool enabled) |
| 867 | { |
| 868 | d_ptr->m_dirtyBits.labelBorderEnabledDirty = true; |
| 869 | if (d_ptr->m_labelBorders != enabled) { |
| 870 | d_ptr->m_labelBorders = enabled; |
| 871 | emit labelBorderEnabledChanged(enabled); |
| 872 | emit d_ptr->needRender(); |
| 873 | } |
| 874 | } |
| 875 | |
| 876 | bool Q3DTheme::isLabelBorderEnabled() const |
| 877 | { |
| 878 | return d_ptr->m_labelBorders; |
| 879 | } |
| 880 | |
| 881 | /*! |
| 882 | * \property Q3DTheme::font |
| 883 | * |
| 884 | * \brief The font to be used for labels. |
| 885 | */ |
| 886 | void Q3DTheme::setFont(const QFont &font) |
| 887 | { |
| 888 | d_ptr->m_dirtyBits.fontDirty = true; |
| 889 | if (d_ptr->m_font != font) { |
| 890 | d_ptr->m_font = font; |
| 891 | emit fontChanged(font); |
| 892 | emit d_ptr->needRender(); |
| 893 | } |
| 894 | } |
| 895 | |
| 896 | QFont Q3DTheme::font() const |
| 897 | { |
| 898 | return d_ptr->m_font; |
| 899 | } |
| 900 | |
| 901 | /*! |
| 902 | * \property Q3DTheme::backgroundEnabled |
| 903 | * |
| 904 | * \brief Whether the background is visible. |
| 905 | * |
| 906 | * The background is drawn by using the value of backgroundColor. |
| 907 | */ |
| 908 | void Q3DTheme::setBackgroundEnabled(bool enabled) |
| 909 | { |
| 910 | d_ptr->m_dirtyBits.backgroundEnabledDirty = true; |
| 911 | if (d_ptr->m_backgoundEnabled != enabled) { |
| 912 | d_ptr->m_backgoundEnabled = enabled; |
| 913 | emit backgroundEnabledChanged(enabled); |
| 914 | emit d_ptr->needRender(); |
| 915 | } |
| 916 | } |
| 917 | |
| 918 | bool Q3DTheme::isBackgroundEnabled() const |
| 919 | { |
| 920 | return d_ptr->m_backgoundEnabled; |
| 921 | } |
| 922 | |
| 923 | /*! |
| 924 | * \property Q3DTheme::gridEnabled |
| 925 | * |
| 926 | * \brief Whether the grid lines are drawn. |
| 927 | * |
| 928 | * This value affects all grid lines. |
| 929 | */ |
| 930 | void Q3DTheme::setGridEnabled(bool enabled) |
| 931 | { |
| 932 | d_ptr->m_dirtyBits.gridEnabledDirty = true; |
| 933 | if (d_ptr->m_gridEnabled != enabled) { |
| 934 | d_ptr->m_gridEnabled = enabled; |
| 935 | emit gridEnabledChanged(enabled); |
| 936 | emit d_ptr->needRender(); |
| 937 | } |
| 938 | } |
| 939 | |
| 940 | bool Q3DTheme::isGridEnabled() const |
| 941 | { |
| 942 | return d_ptr->m_gridEnabled; |
| 943 | } |
| 944 | |
| 945 | /*! |
| 946 | * \property Q3DTheme::labelBackgroundEnabled |
| 947 | * |
| 948 | *\brief Whether the label is drawn with a color background or with a fully |
| 949 | * transparent background. |
| 950 | * |
| 951 | * The labelBackgroundColor value (including alpha) is used for drawing the |
| 952 | * background. |
| 953 | * |
| 954 | * Labels with a background are drawn to equal sizes per axis based |
| 955 | * on the longest label, and the text is centered in them. Labels without a |
| 956 | * background are drawn as is and are left or right aligned based on their |
| 957 | * position in the graph. |
| 958 | */ |
| 959 | void Q3DTheme::setLabelBackgroundEnabled(bool enabled) |
| 960 | { |
| 961 | d_ptr->m_dirtyBits.labelBackgroundEnabledDirty = true; |
| 962 | if (d_ptr->m_labelBackground != enabled) { |
| 963 | d_ptr->m_labelBackground = enabled; |
| 964 | emit labelBackgroundEnabledChanged(enabled); |
| 965 | emit d_ptr->needRender(); |
| 966 | } |
| 967 | } |
| 968 | |
| 969 | bool Q3DTheme::isLabelBackgroundEnabled() const |
| 970 | { |
| 971 | return d_ptr->m_labelBackground; |
| 972 | } |
| 973 | |
| 974 | /*! |
| 975 | * \property Q3DTheme::colorStyle |
| 976 | * |
| 977 | * \brief The style of the graph colors. |
| 978 | * |
| 979 | * One of the ColorStyle enum values. |
| 980 | * |
| 981 | * This value can be overridden by setting \l{Abstract3DSeries::colorStyle} |
| 982 | * {colorStyle} explicitly in the series. |
| 983 | */ |
| 984 | void Q3DTheme::setColorStyle(ColorStyle style) |
| 985 | { |
| 986 | d_ptr->m_dirtyBits.colorStyleDirty = true; |
| 987 | if (d_ptr->m_colorStyle != style) { |
| 988 | d_ptr->m_colorStyle = style; |
| 989 | emit colorStyleChanged(style); |
| 990 | } |
| 991 | } |
| 992 | |
| 993 | Q3DTheme::ColorStyle Q3DTheme::colorStyle() const |
| 994 | { |
| 995 | return d_ptr->m_colorStyle; |
| 996 | } |
| 997 | |
| 998 | /*! |
| 999 | * \property Q3DTheme::type |
| 1000 | * |
| 1001 | * \brief The type of the theme. |
| 1002 | * |
| 1003 | * The type is automatically set when constructing a theme, |
| 1004 | * but can also be changed later. Changing the theme type will change all other |
| 1005 | * properties of the theme to what the predefined theme specifies. |
| 1006 | * Changing the theme type of the active theme of the graph will also reset all |
| 1007 | * attached series to use the new theme. |
| 1008 | */ |
| 1009 | void Q3DTheme::setType(Theme themeType) |
| 1010 | { |
| 1011 | if (themeType >= ThemeQt && themeType <= ThemeUserDefined) { |
| 1012 | d_ptr->m_dirtyBits.themeIdDirty = true; |
| 1013 | if (d_ptr->m_themeId != themeType) { |
| 1014 | d_ptr->m_themeId = themeType; |
| 1015 | ThemeManager::setPredefinedPropertiesToTheme(theme: this, type: themeType); |
| 1016 | emit typeChanged(themeType); |
| 1017 | } |
| 1018 | } |
| 1019 | } |
| 1020 | |
| 1021 | Q3DTheme::Theme Q3DTheme::type() const |
| 1022 | { |
| 1023 | return d_ptr->m_themeId; |
| 1024 | } |
| 1025 | |
| 1026 | // Q3DThemePrivate |
| 1027 | |
| 1028 | Q3DThemePrivate::Q3DThemePrivate(Q3DTheme *q) |
| 1029 | : QObject(0), |
| 1030 | m_themeId(Q3DTheme::ThemeUserDefined), |
| 1031 | m_backgroundColor(Qt::black), |
| 1032 | m_windowColor(Qt::black), |
| 1033 | m_textColor(Qt::white), |
| 1034 | m_textBackgroundColor(Qt::gray), |
| 1035 | m_gridLineColor(Qt::white), |
| 1036 | m_singleHighlightColor(Qt::red), |
| 1037 | m_multiHighlightColor(Qt::blue), |
| 1038 | m_lightColor(Qt::white), |
| 1039 | m_singleHighlightGradient(QLinearGradient(qreal(gradientTextureWidth), |
| 1040 | qreal(gradientTextureHeight), |
| 1041 | 0.0, 0.0)), |
| 1042 | m_multiHighlightGradient(QLinearGradient(qreal(gradientTextureWidth), |
| 1043 | qreal(gradientTextureHeight), |
| 1044 | 0.0, 0.0)), |
| 1045 | m_lightStrength(5.0f), |
| 1046 | m_ambientLightStrength(0.25f), |
| 1047 | m_highlightLightStrength(7.5f), |
| 1048 | m_labelBorders(true), |
| 1049 | m_colorStyle(Q3DTheme::ColorStyleUniform), |
| 1050 | m_font(QFont()), |
| 1051 | m_backgoundEnabled(true), |
| 1052 | m_gridEnabled(true), |
| 1053 | m_labelBackground(true), |
| 1054 | m_isDefaultTheme(false), |
| 1055 | m_forcePredefinedType(true), |
| 1056 | q_ptr(q) |
| 1057 | { |
| 1058 | m_baseColors.append(t: QColor(Qt::black)); |
| 1059 | m_baseGradients.append(t: QLinearGradient(qreal(gradientTextureWidth), |
| 1060 | qreal(gradientTextureHeight), |
| 1061 | 0.0, 0.0)); |
| 1062 | } |
| 1063 | |
| 1064 | Q3DThemePrivate::~Q3DThemePrivate() |
| 1065 | { |
| 1066 | } |
| 1067 | |
| 1068 | void Q3DThemePrivate::resetDirtyBits() |
| 1069 | { |
| 1070 | m_dirtyBits.ambientLightStrengthDirty = true; |
| 1071 | m_dirtyBits.backgroundColorDirty = true; |
| 1072 | m_dirtyBits.backgroundEnabledDirty = true; |
| 1073 | m_dirtyBits.baseColorDirty = true; |
| 1074 | m_dirtyBits.baseGradientDirty = true; |
| 1075 | m_dirtyBits.colorStyleDirty = true; |
| 1076 | m_dirtyBits.fontDirty = true; |
| 1077 | m_dirtyBits.gridEnabledDirty = true; |
| 1078 | m_dirtyBits.gridLineColorDirty = true; |
| 1079 | m_dirtyBits.highlightLightStrengthDirty = true; |
| 1080 | m_dirtyBits.labelBackgroundColorDirty = true; |
| 1081 | m_dirtyBits.labelBackgroundEnabledDirty = true; |
| 1082 | m_dirtyBits.labelBorderEnabledDirty = true; |
| 1083 | m_dirtyBits.labelTextColorDirty = true; |
| 1084 | m_dirtyBits.lightColorDirty = true; |
| 1085 | m_dirtyBits.lightStrengthDirty = true; |
| 1086 | m_dirtyBits.multiHighlightColorDirty = true; |
| 1087 | m_dirtyBits.multiHighlightGradientDirty = true; |
| 1088 | m_dirtyBits.singleHighlightColorDirty = true; |
| 1089 | m_dirtyBits.singleHighlightGradientDirty = true; |
| 1090 | m_dirtyBits.themeIdDirty = true; |
| 1091 | m_dirtyBits.windowColorDirty = true; |
| 1092 | } |
| 1093 | |
| 1094 | bool Q3DThemePrivate::sync(Q3DThemePrivate &other) |
| 1095 | { |
| 1096 | bool updateDrawer = false; |
| 1097 | if (m_dirtyBits.ambientLightStrengthDirty) { |
| 1098 | other.q_ptr->setAmbientLightStrength(m_ambientLightStrength); |
| 1099 | m_dirtyBits.ambientLightStrengthDirty = false; |
| 1100 | } |
| 1101 | if (m_dirtyBits.backgroundColorDirty) { |
| 1102 | other.q_ptr->setBackgroundColor(m_backgroundColor); |
| 1103 | m_dirtyBits.backgroundColorDirty = false; |
| 1104 | } |
| 1105 | if (m_dirtyBits.backgroundEnabledDirty) { |
| 1106 | other.q_ptr->setBackgroundEnabled(m_backgoundEnabled); |
| 1107 | m_dirtyBits.backgroundEnabledDirty = false; |
| 1108 | } |
| 1109 | if (m_dirtyBits.baseColorDirty) { |
| 1110 | other.q_ptr->setBaseColors(m_baseColors); |
| 1111 | m_dirtyBits.baseColorDirty = false; |
| 1112 | } |
| 1113 | if (m_dirtyBits.baseGradientDirty) { |
| 1114 | other.q_ptr->setBaseGradients(m_baseGradients); |
| 1115 | m_dirtyBits.baseGradientDirty = false; |
| 1116 | } |
| 1117 | if (m_dirtyBits.colorStyleDirty) { |
| 1118 | other.q_ptr->setColorStyle(m_colorStyle); |
| 1119 | m_dirtyBits.colorStyleDirty = false; |
| 1120 | } |
| 1121 | if (m_dirtyBits.fontDirty) { |
| 1122 | other.q_ptr->setFont(m_font); |
| 1123 | m_dirtyBits.fontDirty = false; |
| 1124 | updateDrawer = true; |
| 1125 | } |
| 1126 | if (m_dirtyBits.gridEnabledDirty) { |
| 1127 | other.q_ptr->setGridEnabled(m_gridEnabled); |
| 1128 | m_dirtyBits.gridEnabledDirty = false; |
| 1129 | } |
| 1130 | if (m_dirtyBits.gridLineColorDirty) { |
| 1131 | other.q_ptr->setGridLineColor(m_gridLineColor); |
| 1132 | m_dirtyBits.gridLineColorDirty = false; |
| 1133 | } |
| 1134 | if (m_dirtyBits.highlightLightStrengthDirty) { |
| 1135 | other.q_ptr->setHighlightLightStrength(m_highlightLightStrength); |
| 1136 | m_dirtyBits.highlightLightStrengthDirty = false; |
| 1137 | } |
| 1138 | if (m_dirtyBits.labelBackgroundColorDirty) { |
| 1139 | other.q_ptr->setLabelBackgroundColor(m_textBackgroundColor); |
| 1140 | m_dirtyBits.labelBackgroundColorDirty = false; |
| 1141 | updateDrawer = true; |
| 1142 | } |
| 1143 | if (m_dirtyBits.labelBackgroundEnabledDirty) { |
| 1144 | other.q_ptr->setLabelBackgroundEnabled(m_labelBackground); |
| 1145 | m_dirtyBits.labelBackgroundEnabledDirty = false; |
| 1146 | updateDrawer = true; |
| 1147 | } |
| 1148 | if (m_dirtyBits.labelBorderEnabledDirty) { |
| 1149 | other.q_ptr->setLabelBorderEnabled(m_labelBorders); |
| 1150 | m_dirtyBits.labelBorderEnabledDirty = false; |
| 1151 | updateDrawer = true; |
| 1152 | } |
| 1153 | if (m_dirtyBits.labelTextColorDirty) { |
| 1154 | other.q_ptr->setLabelTextColor(m_textColor); |
| 1155 | m_dirtyBits.labelTextColorDirty = false; |
| 1156 | updateDrawer = true; |
| 1157 | } |
| 1158 | if (m_dirtyBits.lightColorDirty) { |
| 1159 | other.q_ptr->setLightColor(m_lightColor); |
| 1160 | m_dirtyBits.lightColorDirty = false; |
| 1161 | } |
| 1162 | if (m_dirtyBits.lightStrengthDirty) { |
| 1163 | other.q_ptr->setLightStrength(m_lightStrength); |
| 1164 | m_dirtyBits.lightStrengthDirty = false; |
| 1165 | } |
| 1166 | if (m_dirtyBits.multiHighlightColorDirty) { |
| 1167 | other.q_ptr->setMultiHighlightColor(m_multiHighlightColor); |
| 1168 | m_dirtyBits.multiHighlightColorDirty = false; |
| 1169 | } |
| 1170 | if (m_dirtyBits.multiHighlightGradientDirty) { |
| 1171 | other.q_ptr->setMultiHighlightGradient(m_multiHighlightGradient); |
| 1172 | m_dirtyBits.multiHighlightGradientDirty = false; |
| 1173 | } |
| 1174 | if (m_dirtyBits.singleHighlightColorDirty) { |
| 1175 | other.q_ptr->setSingleHighlightColor(m_singleHighlightColor); |
| 1176 | m_dirtyBits.singleHighlightColorDirty = false; |
| 1177 | } |
| 1178 | if (m_dirtyBits.singleHighlightGradientDirty) { |
| 1179 | other.q_ptr->setSingleHighlightGradient(m_singleHighlightGradient); |
| 1180 | m_dirtyBits.singleHighlightGradientDirty = false; |
| 1181 | } |
| 1182 | if (m_dirtyBits.themeIdDirty) { |
| 1183 | other.m_themeId = m_themeId; // Set directly to avoid a call to ThemeManager's useTheme() |
| 1184 | m_dirtyBits.themeIdDirty = false; |
| 1185 | } |
| 1186 | if (m_dirtyBits.windowColorDirty) { |
| 1187 | other.q_ptr->setWindowColor(m_windowColor); |
| 1188 | m_dirtyBits.windowColorDirty = false; |
| 1189 | } |
| 1190 | |
| 1191 | return updateDrawer; |
| 1192 | } |
| 1193 | |
| 1194 | QT_END_NAMESPACE |
| 1195 | |