kdganttabstractgrid.cpp

Go to the documentation of this file.
00001 /****************************************************************************
00002  ** Copyright (C) 2001-2006 Klarälvdalens Datakonsult AB.  All rights reserved.
00003  **
00004  ** This file is part of the KD Gantt library.
00005  **
00006  ** This file may be distributed and/or modified under the terms of the
00007  ** GNU General Public License version 2 as published by the Free Software
00008  ** Foundation and appearing in the file LICENSE.GPL included in the
00009  ** packaging of this file.
00010  **
00011  ** Licensees holding valid commercial KD Gantt licenses may use this file in
00012  ** accordance with the KD Gantt Commercial License Agreement provided with
00013  ** the Software.
00014  **
00015  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00016  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00017  **
00018  ** See http://www.kdab.net/kdgantt for
00019  **   information about KD Gantt Commercial License Agreements.
00020  **
00021  ** Contact info@kdab.net if any conditions of this
00022  ** licensing are not clear to you.
00023  **
00024  **********************************************************************/
00025 #include "kdganttabstractgrid.h"
00026 #include "kdganttabstractgrid_p.h"
00027 
00028 using namespace KDGantt;
00029 
00041 AbstractGrid::AbstractGrid( QObject* parent )
00042     : QObject( parent ),
00043       _d( new Private )
00044 {
00045 }
00046 
00048 AbstractGrid::~AbstractGrid()
00049 {
00050     delete _d;
00051 }
00052 
00053 #define d d_func()
00054 
00058 void AbstractGrid::setModel( QAbstractItemModel* model )
00059 {
00060     d->model = model;
00061 }
00062 
00064 QAbstractItemModel* AbstractGrid::model() const
00065 {
00066     return d->model;
00067 }
00068 
00072 void AbstractGrid::setRootIndex( const QModelIndex& idx )
00073 {
00074     d->root = idx;
00075 }
00076 
00078 QModelIndex AbstractGrid::rootIndex() const
00079 {
00080     return d->root;
00081 }
00082 
00086 bool AbstractGrid::isSatisfiedConstraint( const Constraint& c ) const
00087 {
00088     // First check if the data is valid,
00089     // TODO: review if true is the right choice
00090     if ( !c.startIndex().isValid() || !c.endIndex().isValid() ) return true;
00091 
00092     Span ss = mapToChart( c.startIndex() );
00093     Span es = mapToChart( c.endIndex() );
00094     return ( ss.end() <= es.start() );
00095 }
00096 
00130 #include "moc_kdganttabstractgrid.cpp"
00131 

Generated on Thu Mar 4 23:19:13 2010 for KD Chart 2 by  doxygen 1.5.4