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 
17 class PrerenderedLabel;
18 
19 namespace KChart {
20 
21  class AbstractTernaryDiagram;
22 
23  /**
24  * The class for ternary axes
25  */
26  class KCHART_EXPORT TernaryAxis : public AbstractAxis
27  {
28  Q_OBJECT
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 
80 }
81 
82 #endif
AbstractDiagram defines the interface for diagram classes.
Defines a position, using compass terminology.
Stores information about painting diagrams.
The base class for axes.
Base class for diagrams based on a ternary coordinate plane.
PrerenderedLabel is an internal KChart class that simplifies creation and caching of cached text labe...
A set of text attributes.
typedef Orientations
Global namespace.
The class for ternary axes.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jan 27 2022 22:33:23 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.