KGantt

kganttabstractgrid.cpp
1 /*
2  * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3  *
4  * This file is part of the KGantt library.
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 
9 #include "kganttabstractgrid.h"
10 #include "kganttabstractgrid_p.h"
11 
12 #include <QRectF>
13 
14 using namespace KGantt;
15 
16 
18  : QObject( parent ),
19  _d( new Private )
20 {
21 }
22 
24 {
25  delete _d;
26 }
27 
28 #define d d_func()
29 
31 {
32  d->model = model;
33 }
34 
36 {
37  return d->model;
38 }
39 
41 {
42  d->root = idx;
43 }
44 
46 {
47  return d->root;
48 }
49 
51 {
52  // First check if the data is valid,
53  // TODO: review if true is the right choice
54  if ( !c.startIndex().isValid() || !c.endIndex().isValid() ) return true;
55 
56  Span ss = mapToChart( c.startIndex() );
57  Span es = mapToChart( c.endIndex() );
58  return ( ss.end() <= es.start() );
59 }
60 
61 qreal AbstractGrid::mapToChart( const QVariant& value ) const
62 {
63  Q_UNUSED( value );
64  return -1.0;
65 }
66 
68 {
69  Q_UNUSED( x );
70  return QVariant();
71 }
72 
73 void AbstractGrid::drawBackground(QPainter* paint, const QRectF& rect)
74 {
75  Q_UNUSED(paint);
76  Q_UNUSED(rect);
77 }
78 
79 void AbstractGrid::drawForeground(QPainter* paint, const QRectF& rect)
80 {
81  Q_UNUSED(paint);
82  Q_UNUSED(rect);
83 }
84 
85 
86 #include "moc_kganttabstractgrid.cpp"
87 
bool isSatisfiedConstraint(const Constraint &c) const
AbstractGrid(QObject *parent=nullptr)
QModelIndex rootIndex() const
virtual void drawBackground(QPainter *paint, const QRectF &rect)
virtual void drawForeground(QPainter *paint, const QRectF &rect)
virtual void setRootIndex(const QModelIndex &idx)
A class used to represent a dependency.
bool isValid() const const
QModelIndex endIndex() const
Global namespace.
QAbstractItemModel * model() const
virtual bool mapFromChart(const Span &span, const QModelIndex &idx, const QList< Constraint > &constraints=QList< Constraint >()) const =0
QModelIndex startIndex() const
virtual void setModel(QAbstractItemModel *model)
A class representing a start point and a length.
Definition: kganttglobal.h:240
virtual Span mapToChart(const QModelIndex &idx) const =0
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Dec 5 2021 22:32:42 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.