KD Chart API Documentation 3.1
Loading...
Searching...
No Matches
KDChartHeaderFooter.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
11#include "KDChartHeaderFooter.h"
12#include "KDChartHeaderFooter_p.h"
13
14#include "KDChartChart.h"
15#include "KDTextDocument.h"
17#include <QAbstractTextDocumentLayout>
18#include <QFont>
19#include <QLabel>
20#include <QPainter>
21#include <QTextBlock>
22#include <QTextDocumentFragment>
23#include <QtDebug>
24
25#include <KDABLibFakes>
26
27using namespace KDChart;
28
29HeaderFooter::Private::Private()
30 : position(Position::North)
31{
32}
33
34HeaderFooter::Private::~Private()
35{
36}
37
38#define d d_func()
39
41 : TextArea(new Private())
42{
44 init();
45}
46
51
59
60void HeaderFooter::init()
61{
64 ta.setFont(QFont(QLatin1String("helvetica"), 10, QFont::Bold, false));
65
66 Measure m(35.0);
68 ta.setFontSize(m);
69
70 m.setValue(8.0);
72 ta.setMinimalFontSize(m);
73
75}
76
81{
82 auto *headerFooter = new HeaderFooter(new Private(*d), nullptr);
83 headerFooter->setType(type());
84 headerFooter->setPosition(position());
85 headerFooter->setText(text());
86 headerFooter->setTextAttributes(textAttributes());
87 return headerFooter;
88}
89
90bool HeaderFooter::compare(const HeaderFooter &other) const
91{
92 return (type() == other.type()) && (position() == other.position()) &&
93 // also compare members inherited from the base class:
94 (autoReferenceArea() == other.autoReferenceArea()) && (text() == other.text()) && (textAttributes() == other.textAttributes());
95}
96
98{
99 if (d->type != type) {
100 d->type = type;
102 }
103}
104
106{
107 return d->type;
108}
109
111{
112 if (d->position != position) {
113 d->position = position;
115 }
116}
117
119{
120 return d->position;
121}
@ MeasureCalculationModeAbsolute
@ MeasureOrientationMinimum
virtual void setParentWidget(QWidget *widget)
A chart with one or more diagrams.
A header or footer displaying text above or below charts.
HeaderFooterType type() const
void setType(HeaderFooterType type)
HeaderFooter(Chart *parent=nullptr)
void setPosition(Position position)
bool compare(const HeaderFooter &other) const
void setParent(QObject *parent)
void positionChanged(HeaderFooter *)
virtual HeaderFooter * clone() const
void destroyedHeaderFooter(HeaderFooter *)
Measure is used to specify relative and absolute sizes in KDChart, e.g. font sizes.
Defines a position, using compass terminology.
A text area in the chart with a background, a frame, etc.
A set of text attributes.
void setTextAttributes(const TextAttributes &a)
Use this to specify the text attributes to be used for this item.
TextAttributes textAttributes() const
void setAutoReferenceArea(const QObject *area)
const QObject * autoReferenceArea() const
Q_EMITQ_EMIT
QObject * parent() const const
T qobject_cast(QObject *object)
void setParent(QObject *parent)

© 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 Wed May 1 2024 00:01:10 for KD Chart API Documentation by doxygen 1.9.8