KD Chart API Documentation 3.0
Loading...
Searching...
No Matches
KDChartAbstractPieDiagram.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 "KDChartAbstractPieDiagram_p.h"
13
17
18#include <QMap>
19
20#include <KDABLibFakes>
21
22using namespace KDChart;
23
24AbstractPieDiagram::Private::Private()
25{
26}
27
28AbstractPieDiagram::Private::~Private()
29{
30}
31
33 : AbstractPolarDiagram(new Private(), parent, plane)
34{
35 init();
36}
37
41
42void AbstractPieDiagram::init()
43{
44}
45
47{
48 if (other == this)
49 return true;
50 if (!other) {
51 // qDebug() << "AbstractPieDiagram::compare() cannot compare to Null pointer";
52 return false;
53 }
54 /*
55 qDebug() << "\n AbstractPieDiagram::compare():";
56 // compare own properties
57 qDebug() <<
58 (granularity() == other->granularity()) &&
59 (startPosition() == other->startPosition());
60 */
61 return // compare the base class
62 (static_cast<const AbstractPolarDiagram *>(this)->compare(other)) &&
63 // compare own properties
64 (granularity() == other->granularity()) && (startPosition() == other->startPosition());
65}
66
67#define d d_func()
68
70{
71 d->granularity = value;
72}
73
75{
76 return (d->granularity < 0.05 || d->granularity > 36.0)
77 ? 1.0
78 : d->granularity;
79}
80
82{
83 Q_UNUSED(degrees);
84 qWarning() << "Deprecated AbstractPieDiagram::setStartPosition() called, setting ignored.";
85}
86
88{
89 qWarning() << "Deprecated AbstractPieDiagram::startPosition() called.";
90 return 0;
91}
92
94{
95 d->autoRotateLabels = autoRotate;
96}
97
99{
100 return d->autoRotateLabels;
101}
102
104{
105 d->attributesModel->setModelData(QVariant::fromValue(attrs), PieAttributesRole);
106 emit layoutChanged(this);
107}
108
110{
111 d->setDatasetAttrs(column, QVariant::fromValue(attrs), PieAttributesRole);
112 emit layoutChanged(this);
113}
114
116{
117 d->attributesModel->setData(index, QVariant::fromValue(attrs), PieAttributesRole);
118 emit layoutChanged(this);
119}
120
122{
123 return d->attributesModel->data(PieAttributesRole).value<PieAttributes>();
124}
125
127{
128 const QVariant attrs(d->datasetAttrs(column, PieAttributesRole));
129 if (attrs.isValid())
130 return attrs.value<PieAttributes>();
131 return pieAttributes();
132}
133
135{
136 return d->attributesModel->data(
137 d->attributesModel->mapFromSource(index),
139 .value<PieAttributes>();
140}
141
147
149{
150 d->setDatasetAttrs(column, QVariant::fromValue(tda), ThreeDPieAttributesRole);
151 emit layoutChanged(this);
152}
153
159
164
166{
167 const QVariant attrs(d->datasetAttrs(column, ThreeDPieAttributesRole));
168 if (attrs.isValid())
169 return attrs.value<ThreeDPieAttributes>();
170 return threeDPieAttributes();
171}
172
174{
175 return d->attributesModel->data(
176 d->attributesModel->mapFromSource(index),
178 .value<ThreeDPieAttributes>();
179}
void layoutChanged(AbstractDiagram *)
Base class for any diagram type.
bool compare(const AbstractPieDiagram *other) const
ThreeDPieAttributes threeDPieAttributes() const
AbstractPieDiagram(QWidget *parent=nullptr, PolarCoordinatePlane *plane=nullptr)
Q_DECL_DEPRECATED void setStartPosition(int degrees)
Q_DECL_DEPRECATED int startPosition() const
void setPieAttributes(const PieAttributes &a)
void setThreeDPieAttributes(const ThreeDPieAttributes &a)
Base class for diagrams based on a polar coordinate system.
A set of attributes controlling the appearance of pie charts.
@ ThreeDPieAttributesRole
@ PieAttributesRole
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
QAbstractItemModel * model() const const
T qobject_cast(QObject *object)
QVariant fromValue(const T &value)

© 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 on Fri Feb 23 2024 00:02:59 for KD Chart API Documentation by doxygen 1.9.8