KChart

KChartTernaryAxis.h
1/*
2 * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3 *
4 * This file is part of the KD Chart library.
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#ifndef KCHARTTERNARYAXIS_H
10#define KCHARTTERNARYAXIS_H
11
12
13#include <KChartAbstractAxis.h>
14#include <KChartPosition.h>
15#include <KChartTextAttributes.h>
16
18
19namespace KChart {
20
22
23 /**
24 * The class for ternary axes
25 */
26 class KCHART_EXPORT TernaryAxis : public AbstractAxis
27 {
29
30 Q_DISABLE_COPY( TernaryAxis )
31 KCHART_DECLARE_PRIVATE_DERIVED_PARENT( TernaryAxis, AbstractDiagram* )
32
33 public:
34 explicit TernaryAxis ( AbstractTernaryDiagram* diagram = nullptr );
35 ~TernaryAxis() override;
36
37 void paintAll( QPainter &) override;
38 void paint (QPainter *) override;
39 void paintCtx (PaintContext *) override;
40
41 QRect geometry () const override;
42 void setGeometry (const QRect &rect) override;
43
44 bool isEmpty () const override;
45 QSize minimumSize () const override;
46 QSize maximumSize () const override;
47 QSize sizeHint () const override;
48 Qt::Orientations expandingDirections () const override;
49
50 virtual const Position position () const;
51 virtual void setPosition (Position p);
52
53 void setTitleText( const QString& text );
54 QString titleText() const;
55 void setTitleTextAttributes( const TextAttributes &a );
56 TextAttributes titleTextAttributes() const;
57 void resetTitleTextAttributes();
58 bool hasDefaultTitleTextAttributes() const;
59
60 QPair<QSizeF, QSizeF> requiredMargins() const;
61
62 private:
63 void updatePrerenderedLabels();
64 // TODO, move class variables to private class
65 QRect m_geometry;
66 Position m_position;
67
68 QString m_title;
69 TextAttributes m_titleAttributes;
70
71 // FIXME (Mirko): Move axis labels from grid to here, do not
72 // expose them, just paint them. Use title text for text. Make
73 // a function to allow the coordinate plane to calculate the
74 // necessary margins, like this:
75 PrerenderedLabel* m_label;
76 PrerenderedLabel* m_fifty;
77 };
78
79 typedef QList<TernaryAxis*> TernaryAxisList;
80}
81
82#endif
AbstractDiagram defines the interface for diagram classes.
Base class for diagrams based on a ternary coordinate plane.
Stores information about painting diagrams.
Defines a position, using compass terminology.
void paintAll(QPainter &) override
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invo...
void paintCtx(PaintContext *) override
Default impl: Paint the complete item using its layouted position and size.
A set of text attributes.
PrerenderedLabel is an internal KChart class that simplifies creation and caching of cached text labe...
Q_OBJECTQ_OBJECT
typedef Orientations
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:56:24 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.