KD Chart API Documentation  3.1
KDChartAbstractThreeDAttributes.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** This file is part of the KD Chart library.
4 **
5 ** SPDX-FileCopyrightText: 2001 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6 **
7 ** SPDX-License-Identifier: MIT
8 **
9 ****************************************************************************/
10 
12 #include "KDChartAbstractThreeDAttributes_p.h"
13 
14 #include <KDABLibFakes>
15 #include <QBrush>
16 #include <QDebug>
17 
18 #define d d_func()
19 
20 using namespace KDChart;
21 
22 AbstractThreeDAttributes::Private::Private()
23 {
24 }
25 
27  : _d(new Private())
28 {
29 }
30 
32  : _d(new Private(*r.d))
33 {
34 }
35 
37 {
38  if (this == &r)
39  return *this;
40 
41  *d = *r.d;
42 
43  return *this;
44 }
45 
47 {
48  delete _d;
49  _d = nullptr;
50 }
51 
53 {
54  return isEnabled() == r.isEnabled() && depth() == r.depth() && isThreeDBrushEnabled() == r.isThreeDBrushEnabled();
55 }
56 
57 void AbstractThreeDAttributes::init()
58 {
59 }
60 
62 {
63  d->enabled = enabled;
64 }
65 
67 {
68  return d->enabled;
69 }
70 
72 {
73  d->depth = depth;
74 }
75 
77 {
78  return d->depth;
79 }
80 
82 {
83  return isEnabled() ? d->depth : 0.0;
84 }
85 
87 {
88  return d->threeDBrushEnabled;
89 }
90 
92 {
93  d->threeDBrushEnabled = enabled;
94 }
95 
96 QBrush AbstractThreeDAttributes::threeDBrush(const QBrush &brush, const QRectF &rect) const
97 {
98  if (isThreeDBrushEnabled()) {
99  QLinearGradient gr(rect.topLeft(), rect.bottomRight());
100  gr.setColorAt(0.0, brush.color());
101  gr.setColorAt(0.5, brush.color().lighter(180));
102  gr.setColorAt(1.0, brush.color());
103  return QBrush(gr);
104  }
105  return brush;
106 }
107 
108 #if !defined(QT_NO_DEBUG_STREAM)
109 QDebug operator<<(QDebug dbg, const KDChart::AbstractThreeDAttributes &a)
110 {
111  dbg << "enabled=" << a.isEnabled()
112  << "depth=" << a.depth();
113  return dbg;
114 }
115 #endif /* QT_NO_DEBUG_STREAM */
virtual QBrush threeDBrush(const QBrush &brush, const QRectF &rect) const
bool operator==(const AbstractThreeDAttributes &) const
AbstractThreeDAttributes & operator=(const AbstractThreeDAttributes &)
QDebug operator<<(QDebug stream, const DataDimension &r)

© 2001 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-chart/
Generated by doxygen 1.9.1