KD Chart API Documentation 3.1
Loading...
Searching...
No Matches
KDChartTextLabelCache.h
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#ifndef KDCHARTTEXTLABELCACHE_H
12#define KDCHARTTEXTLABELCACHE_H
13
14#include <QBrush>
15#include <QFont>
16#include <QPen>
17#include <QPixmap>
18
19#include "KDChartEnums.h"
20
25{
26public:
29 {
30 }
31
35 virtual const QPixmap &pixmap() const = 0;
36
40
42 void setPosition(const QPointF &position);
44 const QPointF &position() const;
45
53
54protected:
61 virtual void invalidate() const = 0;
62
63private:
64 QPointF m_position;
66};
67
84// FIXME this is merely a prototype
85// FIXME caching could be done by a second layer that can be used to,
86// e.g., query for a prerendered element by id or name, or by changing
87// the pixmap() method to do lazy evaluation.
89{
90public:
92 ~PrerenderedLabel() override;
93
94 void setFont(const QFont &font);
95 const QFont &font() const;
96
97 void setText(const QString &text);
98 const QString &text() const;
99
100 void setBrush(const QBrush &brush);
101 const QBrush &brush() const;
102
103 void setPen(const QPen &);
104 const QPen &pen() const;
105
106 void setAngle(qreal angle);
107 qreal angle() const;
108
109 // reimp PrerenderedElement:
110 const QPixmap &pixmap() const override;
112 // overload: return location of referencePoint():
114
115protected:
116 void invalidate() const override;
117
118private:
122 void paint() const;
123
124 // store the settings (these are used for the painting):
125 mutable bool m_dirty = true;
126 QFont m_font;
127 QString m_text;
128 QBrush m_brush;
129 QPen m_pen;
130 qreal m_angle = 0.0;
131
132 // these are valid once the label has been rendered:
133 mutable QPixmap m_pixmap;
134 mutable QPointF m_referenceBottomLeft;
135 mutable QPointF m_textBaseLineVector;
136 mutable QPointF m_textAscendVector;
137};
138
139#endif
Definition of global enums.
base class for prerendered elements like labels, pixmaps, markers, etc.
KDChartEnums::PositionValue referencePoint() const
void setReferencePoint(KDChartEnums::PositionValue)
virtual QPointF referencePointLocation(KDChartEnums::PositionValue) const =0
virtual void invalidate() const =0
void setPosition(const QPointF &position)
virtual const QPixmap & pixmap() const =0
const QPointF & position() const
PrerenderedLabel is an internal KDChart class that simplifies creation and caching of cached text lab...
void setAngle(qreal angle)
const QString & text() const
QPointF referencePointLocation() const
const QPen & pen() const
void setFont(const QFont &font)
const QBrush & brush() const
void invalidate() const override
const QFont & font() const
void setBrush(const QBrush &brush)
const QPixmap & pixmap() const override
void setPen(const QPen &)
void setText(const QString &text)

© 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