KChart

KChartAbstractArea.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 KCHARTABSTRACTAREA_H
10#define KCHARTABSTRACTAREA_H
11
12#include <QObject>
13
14#include "KChartGlobal.h"
15#include "KChartAbstractAreaBase.h"
16#include "KChartLayoutItems.h"
17
18namespace KChart {
19
20
21/**
22 * @class AbstractArea KChartAbstractArea.h
23 * @brief An area in the chart with a background, a frame, etc.
24 *
25 * AbstractArea is the base class for all non-widget chart elements that have
26 * a set of background attributes and frame attributes, such as
27 * coordinate planes or axes.
28 *
29 * @note This class inherits from AbstractAreaBase, AbstractLayoutItem, QObject.
30 * The reason for this triple inheritance is that neither AbstractAreaBase nor
31 * AbstractLayoutItem are QObject.
32 */
33class KCHART_EXPORT AbstractArea : public QObject,
34 public AbstractAreaBase,
36{
37 Q_OBJECT
38
39 Q_DISABLE_COPY( AbstractArea )
40 KCHART_DECLARE_PRIVATE_DERIVED( AbstractArea )
41
42public:
43 ~AbstractArea() override;
44
45 /**
46 * @brief Draws the background and frame, then calls paint().
47 *
48 * In most cases there is no need to overwrite this method in a derived
49 * class, but you would overwrite AbstractLayoutItem::paint() instead.
50 */
51 virtual void paintIntoRect( QPainter& painter, const QRect& rect );
52
53 /**
54 * Call paintAll, if you want the background and the frame to be drawn
55 * before the normal paint() is invoked automatically.
56 */
57 void paintAll( QPainter& painter ) override;
58
59 /**
60 * This is called at layout time by KChart::AutoSpacerLayoutItem::sizeHint().
61 *
62 * The method triggers AbstractArea::sizeHint() to find out the
63 * amount of overlap at the left edge of the area.
64 *
65 * \note The default implementation is not using any caching,
66 * it might make sense to implement a more sophisticated solution
67 * for derived classes that have complex work to do in sizeHint().
68 * All we have here is a primitive flag to be set by the caller
69 * if it is sure that no sizeHint() needs to be called.
70 */
71 virtual int leftOverlap( bool doNotRecalculate=false ) const;
72 /**
73 * This is called at layout time by KChart::AutoSpacerLayoutItem::sizeHint().
74 *
75 * The method triggers AbstractArea::sizeHint() to find out the
76 * amount of overlap at the right edge of the area.
77 *
78 * \note The default implementation is not using any caching,
79 * it might make sense to implement a more sophisticated solution
80 * for derived classes that have complex work to do in sizeHint().
81 * All we have here is a primitive flag to be set by the caller
82 * if it is sure that no sizeHint() needs to be called.
83 */
84 virtual int rightOverlap( bool doNotRecalculate=false ) const;
85 /**
86 * This is called at layout time by KChart::AutoSpacerLayoutItem::sizeHint().
87 *
88 * The method triggers AbstractArea::sizeHint() to find out the
89 * amount of overlap at the top edge of the area.
90 *
91 * \note The default implementation is not using any caching,
92 * it might make sense to implement a more sophisticated solution
93 * for derived classes that have complex work to do in sizeHint().
94 * All we have here is a primitive flag to be set by the caller
95 * if it is sure that no sizeHint() needs to be called.
96 */
97 virtual int topOverlap( bool doNotRecalculate=false ) const;
98 /**
99 * This is called at layout time by KChart:AutoSpacerLayoutItem::sizeHint().
100 *
101 * The method triggers AbstractArea::sizeHint() to find out the
102 * amount of overlap at the bottom edge of the area.
103 *
104 * \note The default implementation is not using any caching,
105 * it might make sense to implement a more sophisticated solution
106 * for derived classes that have complex work to do in sizeHint().
107 * All we have here is a primitive flag to be set by the caller
108 * if it is sure that no sizeHint() needs to be called.
109 */
110 virtual int bottomOverlap( bool doNotRecalculate=false ) const;
111
112protected:
113 AbstractArea();
114 QRect areaGeometry() const override;
115 void positionHasChanged() override;
116
117Q_SIGNALS:
118 void positionChanged( KChart::AbstractArea * );
119}; // End of class AbstractArea
120
121}
122#endif // KCHARTABSTRACTAREA_H
Contains KChart macros.
Base class for AbstractArea and AbstractAreaWidget: An area in the chart with a background,...
An area in the chart with a background, a frame, etc.
Base class for all layout items of KChart.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:40:00 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.