kdgantt
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 used under the terms of the GNU General Public 00007 ** License versions 2.0 or 3.0 as published by the Free Software 00008 ** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3 00009 ** included in the packaging of this file. Alternatively you may (at 00010 ** your option) use any later version of the GNU General Public 00011 ** License if such license has been publicly approved by 00012 ** Klarälvdalens Datakonsult AB (or its successors, if any). 00013 ** 00014 ** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, 00015 ** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR 00016 ** A PARTICULAR PURPOSE. Klarälvdalens Datakonsult AB reserves all rights 00017 ** not expressly granted herein. 00018 ** 00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00021 ** 00022 **********************************************************************/ 00023 #include "kdganttabstractgrid.h" 00024 #include "kdganttabstractgrid_p.h" 00025 00026 using namespace KDGantt; 00027 00039 AbstractGrid::AbstractGrid( QObject* parent ) 00040 : QObject( parent ), 00041 _d( new Private ) 00042 { 00043 } 00044 00046 AbstractGrid::~AbstractGrid() 00047 { 00048 delete _d; 00049 } 00050 00051 #define d d_func() 00052 00056 void AbstractGrid::setModel( QAbstractItemModel* model ) 00057 { 00058 d->model = model; 00059 } 00060 00062 QAbstractItemModel* AbstractGrid::model() const 00063 { 00064 return d->model; 00065 } 00066 00070 void AbstractGrid::setRootIndex( const QModelIndex& idx ) 00071 { 00072 d->root = idx; 00073 } 00074 00076 QModelIndex AbstractGrid::rootIndex() const 00077 { 00078 return d->root; 00079 } 00080 00084 bool AbstractGrid::isSatisfiedConstraint( const Constraint& c ) const 00085 { 00086 // First check if the data is valid, 00087 // TODO: review if true is the right choice 00088 if ( !c.startIndex().isValid() || !c.endIndex().isValid() ) return true; 00089 00090 Span ss = mapToChart( c.startIndex() ); 00091 Span es = mapToChart( c.endIndex() ); 00092 return ( ss.end() <= es.start() ); 00093 } 00094 00128 #include "moc_kdganttabstractgrid.cpp" 00129
KDE 4.2 API Reference