KChart

ReverseMapper.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 REVERSEMAPPER_H
10#define REVERSEMAPPER_H
11
12#include <QModelIndex>
13#include <QHash>
14
15QT_BEGIN_NAMESPACE
16class QRectF;
17class QGraphicsScene;
18class QPolygonF;
19QT_END_NAMESPACE
20
21namespace KChart {
22
23 class AbstractDiagram;
24 class ChartGraphicsItem;
25
26 /**
27 * @brief The ReverseMapper stores information about objects on a chart and their respective model indexes
28 * \internal
29 */
31 {
32
33 public:
35 explicit ReverseMapper( AbstractDiagram* diagram );
36
38
39 void setDiagram( AbstractDiagram* diagram );
40
41 void clear();
42
43 QModelIndexList indexesAt( const QPointF& point ) const;
44 QModelIndexList indexesIn( const QRect& rect ) const;
45
46 QPolygonF polygon( int row, int column ) const;
47 QRectF boundingRect( int row, int column ) const;
48
49 // convenience methods:
50 void addPolygon( int row, int column, const QPolygonF& polygon );
51 void addRect( int row, int column, const QRectF& rect );
52 void addCircle( int row, int column, const QPointF& location, const QSizeF& diameter );
53 void addLine( int row, int column, const QPointF& from, const QPointF& to );
54
55 private:
56 void populateScene() const;
57
58 AbstractDiagram* m_diagram;
60 mutable QGraphicsScene* m_scene;
61 mutable bool m_sceneDirty = true;
62 };
63
64}
65
66#endif
AbstractDiagram defines the interface for diagram classes.
The ReverseMapper stores information about objects on a chart and their respective model indexes.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:24 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.