KChart

KChartTernaryAxis.h
1 /*
2  * Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3  *
4  * This file is part of the KD Chart library.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef KCHARTTERNARYAXIS_H
21 #define KCHARTTERNARYAXIS_H
22 
23 
24 #include <KChartAbstractAxis.h>
25 #include <KChartPosition.h>
26 #include <KChartTextAttributes.h>
27 
28 class PrerenderedLabel;
29 
30 namespace KChart {
31 
32  class AbstractTernaryDiagram;
33 
37  class KCHART_EXPORT TernaryAxis : public AbstractAxis
38  {
39  Q_OBJECT
40 
41  Q_DISABLE_COPY( TernaryAxis )
42  KCHART_DECLARE_PRIVATE_DERIVED_PARENT( TernaryAxis, AbstractDiagram* )
43 
44  public:
45  explicit TernaryAxis ( AbstractTernaryDiagram* diagram = nullptr );
46  ~TernaryAxis();
47 
48  void paintAll( QPainter &) override;
49  void paint (QPainter *) override;
50  void paintCtx (PaintContext *) override;
51 
52  QRect geometry () const override;
53  void setGeometry (const QRect &rect) override;
54 
55  bool isEmpty () const override;
56  QSize minimumSize () const override;
57  QSize maximumSize () const override;
58  QSize sizeHint () const override;
59  Qt::Orientations expandingDirections () const override;
60 
61  virtual const Position position () const;
62  virtual void setPosition (Position p);
63 
64  void setTitleText( const QString& text );
65  QString titleText() const;
66  void setTitleTextAttributes( const TextAttributes &a );
67  TextAttributes titleTextAttributes() const;
68  void resetTitleTextAttributes();
69  bool hasDefaultTitleTextAttributes() const;
70 
71  QPair<QSizeF, QSizeF> requiredMargins() const;
72 
73  private:
74  void updatePrerenderedLabels();
75  // TODO, move class variables to private class
76  QRect m_geometry;
77  Position m_position;
78 
79  QString m_title;
80  TextAttributes m_titleAttributes;
81 
82  // FIXME (Mirko): Move axis labels from grid to here, do not
83  // expose them, just paint them. Use title text for text. Make
84  // a function to allow the coordinate plane to calculate the
85  // necessary margins, like this:
86  PrerenderedLabel* m_label;
87  PrerenderedLabel* m_fifty;
88  };
89 
91 }
92 
93 #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-2020 The KDE developers.
Generated on Thu Sep 17 2020 22:36:40 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.