1 // Copyright (C) 2009-2012 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef __HEXABLOCKGUI_DOCUMENTDELEGATE_HXX_
20 #define __HEXABLOCKGUI_DOCUMENTDELEGATE_HXX_
23 // QEvent * event, QAbstractItemModel
26 #include <QItemDelegate>
27 #include <QModelIndex>
32 #include <QDockWidget>
35 #include "HEXABLOCKGUI_DocumentModel.hxx"
36 #include "HEXABLOCKGUI_DocumentSelectionModel.hxx"
42 class DocumentDelegate : public QItemDelegate
47 DocumentDelegate( QDockWidget *dw, QObject *parent = 0);
49 QWidget *createEditor( QWidget *parent,
50 const QStyleOptionViewItem &option,
51 const QModelIndex &index) const;
53 void setEditorData( QWidget *editor, const QModelIndex &index) const;
55 void setModelData( QWidget *editor,
56 QAbstractItemModel *model,
57 const QModelIndex &index ) const;
59 void updateEditorGeometry( QWidget *editor,
60 const QStyleOptionViewItem &option,
61 const QModelIndex &index ) const;
63 // can be used by editor
64 void setDocumentModel( DocumentModel* m );
67 void setPatternDataSelectionModel( PatternDataSelectionModel* s );
68 void setPatternBuilderSelectionModel( PatternBuilderSelectionModel* s );
69 void setGroupsSelectionModel( /*QItemSelectionModel**/ GroupsSelectionModel* s );
70 void setMeshSelectionModel( MeshSelectionModel* s );
72 virtual bool editorEvent ( QEvent * event,
73 QAbstractItemModel * model,
74 const QStyleOptionViewItem & option,
75 const QModelIndex & index );
78 // void onCloseEditor( QWidget *, QAbstractItemDelegate::EndEditHint);
79 // void onCommitData ( QWidget * editor );
82 QDockWidget *_dw; // editor's container
84 // can be used by editor
85 DocumentModel* _documentModel;
87 PatternDataSelectionModel* _patternDataSelectionModel;
88 PatternBuilderSelectionModel* _patternBuilderSelectionModel;
89 GroupsSelectionModel* _groupsSelectionModel;
90 MeshSelectionModel* _meshSelectionModel;