1 // Copyright (C) 2009-2013 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"
37 #include "HEXABLOCKGUI_DocumentItem.hxx"
38 #include "HEXABLOCKGUI_DocumentPanel.hxx"
40 #include "hexa_base.hxx"
46 class HexaExport DocumentDelegate : public QItemDelegate
54 DocumentDelegate( QDockWidget *dw, QObject *parent = 0);
57 QWidget *createEditor( QWidget *parent,
58 const QStyleOptionViewItem &option,
59 const QModelIndex &index) const;
62 void setEditorData( QWidget *editor, const QModelIndex &index) const;
64 /// set the editor's model
65 void setModelData( QWidget *editor,
66 QAbstractItemModel *model,
67 const QModelIndex &index ) const {};
69 virtual void updateEditorGeometry( QWidget *editor,
70 const QStyleOptionViewItem &option,
71 const QModelIndex &index ) const {};
74 mutable QWidget* _currentEditor;
75 virtual bool editorEvent ( QEvent * event,
76 QAbstractItemModel * model,
77 const QStyleOptionViewItem & option, const QModelIndex & index );
78 virtual bool eventFilter ( QObject * editor, QEvent * event );
81 QDockWidget* _dw; // creator's container