00001 /**************************************************************************** 00002 ** Copyright (C) 2001-2011 Klaralvdalens Datakonsult AB. All rights reserved. 00003 ** 00004 ** This file is part of the KD Chart library. 00005 ** 00006 ** Licensees holding valid commercial KD Chart licenses may use this file in 00007 ** accordance with the KD Chart Commercial License Agreement provided with 00008 ** the Software. 00009 ** 00010 ** 00011 ** This file may be distributed and/or modified under the terms of the 00012 ** GNU General Public License version 2 and version 3 as published by the 00013 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included. 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 ** Contact info@kdab.com if any conditions of this licensing are not 00019 ** clear to you. 00020 ** 00021 **********************************************************************/ 00022 00023 #ifndef KDGANTTCONSTRAINTPROXY_H 00024 #define KDGANTTCONSTRAINTPROXY_H 00025 00026 #include "kdganttglobal.h" 00027 00028 #include <QPointer> 00029 00030 class QAbstractProxyModel; 00031 00032 namespace KDGantt { 00033 class Constraint; 00034 class ConstraintModel; 00035 00036 class ConstraintProxy : public QObject { 00037 Q_OBJECT 00038 public: 00039 explicit ConstraintProxy( QObject* parent = 0 ); 00040 virtual ~ConstraintProxy(); 00041 00042 void setSourceModel( ConstraintModel* src ); 00043 void setDestinationModel( ConstraintModel* dest ); 00044 void setProxyModel( QAbstractProxyModel* proxy ); 00045 00046 ConstraintModel* sourceModel() const; 00047 ConstraintModel* destinationModel() const; 00048 QAbstractProxyModel* proxyModel() const; 00049 00050 00051 private Q_SLOTS: 00052 00053 void slotSourceConstraintAdded( const KDGantt::Constraint& ); 00054 void slotSourceConstraintRemoved( const KDGantt::Constraint& ); 00055 00056 void slotDestinationConstraintAdded( const KDGantt::Constraint& ); 00057 void slotDestinationConstraintRemoved( const KDGantt::Constraint& ); 00058 00059 void slotLayoutChanged(); 00060 00061 private: 00062 void copyFromSource(); 00063 00064 QPointer<QAbstractProxyModel> m_proxy; 00065 QPointer<ConstraintModel> m_source; 00066 QPointer<ConstraintModel> m_destination; 00067 }; 00068 } 00069 00070 #endif /* KDGANTTCONSTRAINTPROXY_H */ 00071