KD Chart API Documentation  3.1
kdganttabstractgrid.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 KDGANTTABSTRACTGRID_H
12 #define KDGANTTABSTRACTGRID_H
13 
14 #include "kdganttconstraint.h"
15 #include "kdganttglobal.h"
16 
17 QT_BEGIN_NAMESPACE
18 class QPainter;
19 class QRectF;
20 class QAbstractItemModel;
21 class QModelIndex;
22 QT_END_NAMESPACE
23 
24 namespace KDGantt {
26 class Span;
27 
28 class KDGANTT_EXPORT AbstractGrid : public QObject
29 {
30  Q_OBJECT
32  friend class GraphicsScene;
33 
34 public:
35  AbstractGrid(QObject *parent = nullptr);
36  ~AbstractGrid() override;
37 
38  QAbstractItemModel *model() const;
39  QModelIndex rootIndex() const;
40 
41  virtual Span mapToChart(const QModelIndex &idx) const = 0;
42  virtual bool mapFromChart(const Span &span, const QModelIndex &idx,
43  const QList<Constraint> &constraints = QList<Constraint>()) const = 0;
44  virtual qreal mapToChart(const QVariant &value) const;
45  virtual QVariant mapFromChart(qreal x) const;
46  bool isSatisfiedConstraint(const Constraint &c) const;
47 
48  virtual void paintGrid(QPainter *painter, const QRectF &sceneRect, const QRectF &exposedRect,
49  AbstractRowController *rowController = nullptr, QWidget *widget = nullptr) = 0;
50  virtual void paintHeader(QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect,
51  qreal offset, QWidget *widget = nullptr) = 0;
52 
53 public Q_SLOTS:
54  /*internal*/ virtual void setModel(QAbstractItemModel *model);
55  /*internal*/ virtual void setRootIndex(const QModelIndex &idx);
56 Q_SIGNALS:
57  void gridChanged();
58 
59 protected:
60  virtual void drawBackground(QPainter *paint, const QRectF &rect);
61  virtual void drawForeground(QPainter *paint, const QRectF &rect);
62 };
63 }
64 
65 #endif /* KDGANTTABSTRACTGRID_H */
Abstract baseclass for grids.
Abstract baseclass for row controllers.
A class used to represent a dependency.
A class representing a start point and a length.
Contains KDGantt macros.
#define KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC(X)

© 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