1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef HYDROGUI_PriorityTableModel_H
24 #define HYDROGUI_PriorityTableModel_H
27 #include <HYDROData_PriorityQueue.h>
29 #include <QAbstractTableModel>
30 #include <QStringList>
33 class HYDROGUI_Module;
37 * \class HYDROGUI_PriorityTableModel
38 * \brief The class representing custom table model for the priority rules
40 class HYDRO_EXPORT HYDROGUI_PriorityTableModel : public QAbstractTableModel
45 HYDROGUI_PriorityTableModel( QObject* theParent = 0 );
46 virtual ~HYDROGUI_PriorityTableModel();
48 virtual Qt::ItemFlags flags( const QModelIndex & theIndex ) const;
50 virtual QVariant data( const QModelIndex &theIndex, int theRole = Qt::DisplayRole ) const;
51 virtual bool setData( const QModelIndex & theIndex, const QVariant & theValue, int theRole = Qt::EditRole );
53 virtual int rowCount( const QModelIndex &theParent = QModelIndex() ) const;
54 virtual int columnCount( const QModelIndex &theParent = QModelIndex() ) const;
56 virtual QVariant headerData( int theSection,
57 Qt::Orientation theOrientation,
58 int theRole = Qt::DisplayRole ) const;
60 virtual bool removeRows( int theRow, int theCount, const QModelIndex & theParent = QModelIndex() );
62 bool removeRows( const QList<int> theRows );
65 void setObjects( const QList<Handle(HYDROData_Object)>& theObjects );
67 void setRules( const HYDROData_ListOfRules& theObjects );
68 HYDROData_ListOfRules getRules() const;
71 bool canCreateNewRule() const;
74 bool isUsed( const Handle(HYDROData_Object)& theObj1,
75 const Handle(HYDROData_Object)& theObj2 ) const;
77 QStringList getAvailablePairs( const Handle(HYDROData_Object)& theObject ) const;
79 QString priorityToString( const int thePriority ) const;
80 QString mergeTypeToString( const int theMergeType ) const;
83 void showError( const QString& theMsg );
86 friend class test_HYDROGUI_PriorityTableModel;
88 HYDROGUI_Module* myModule;
90 HYDROData_ListOfRules myRules;
91 QList<Handle(HYDROData_Object)> myObjects;