KD Chart API Documentation  3.1
ReverseMapper.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** This file is part of the KD Chart library.
4 **
5 ** SPDX-FileCopyrightText: 2001 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6 **
7 ** SPDX-License-Identifier: MIT
8 **
9 ****************************************************************************/
10 
11 #ifndef REVERSEMAPPER_H
12 #define REVERSEMAPPER_H
13 
14 #include <QHash>
15 #include <QModelIndex>
16 
17 QT_BEGIN_NAMESPACE
18 class QRectF;
19 class QGraphicsScene;
20 class QPolygonF;
21 QT_END_NAMESPACE
22 
23 namespace KDChart {
24 
25 class AbstractDiagram;
26 class ChartGraphicsItem;
27 
33 {
34 public:
35  ReverseMapper();
36  explicit ReverseMapper(AbstractDiagram *diagram);
37 
39 
40  void setDiagram(AbstractDiagram *diagram);
41 
42  void clear();
43 
44  QModelIndexList indexesAt(const QPointF &point) const;
45  QModelIndexList indexesIn(const QRect &rect) const;
46 
47  QPolygonF polygon(int row, int column) const;
48  QRectF boundingRect(int row, int column) const;
49 
50  void addItem(ChartGraphicsItem *item);
51 
52  // convenience methods:
53  void addPolygon(int row, int column, const QPolygonF &polygon);
54  void addRect(int row, int column, const QRectF &rect);
55  void addCircle(int row, int column, const QPointF &location, const QSizeF &diameter);
56  void addLine(int row, int column, const QPointF &from, const QPointF &to);
57 
58 private:
59  QGraphicsScene *m_scene = nullptr;
60  AbstractDiagram *m_diagram = nullptr;
61  QHash<QModelIndex, ChartGraphicsItem *> m_itemMap;
62 };
63 }
64 
65 #endif
AbstractDiagram defines the interface for diagram classes.
Graphics item used inside of the ReverseMapper.
The ReverseMapper stores information about objects on a chart and their respective model indexes.
Definition: ReverseMapper.h:33
QModelIndexList indexesIn(const QRect &rect) const
void setDiagram(AbstractDiagram *diagram)
void addItem(ChartGraphicsItem *item)
QPolygonF polygon(int row, int column) const
void addCircle(int row, int column, const QPointF &location, const QSizeF &diameter)
void addLine(int row, int column, const QPointF &from, const QPointF &to)
void addRect(int row, int column, const QRectF &rect)
QRectF boundingRect(int row, int column) const
void addPolygon(int row, int column, const QPolygonF &polygon)
QModelIndexList indexesAt(const QPointF &point) const

© 2001 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-chart/
Generated by doxygen 1.9.1