itom  4.1.0
QVariantDelegate.h
1 // *************************************************************************************************
2 //
3 // QPropertyEditor v 0.3
4 //
5 // --------------------------------------
6 // Copyright (C) 2007 Volker Wiendl
7 // Acknowledgements to Roman alias banal from qt-apps.org for the Enum enhancement
8 //
9 //
10 // The QPropertyEditor Library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by the Free Software
12 // Foundation; either version 2 of the License, or (at your option) any later
13 // version.
14 //
15 // This program is distributed in the hope that it will be useful, but WITHOUT
16 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public License along with
20 // this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 // Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22 // http://www.gnu.org/copyleft/lesser.txt.
23 //
24 // *************************************************************************************************
25 #ifndef COLORSELECTIONBUTTON_H_
26 #define COLORSELECTIONBUTTON_H_
27 
28 #include <qitemdelegate.h>
29 #include "defines.h"
30 
31 class QSignalMapper;
32 
36 class QVariantDelegate : public QItemDelegate
37 {
38  Q_OBJECT
39 
40 public:
45  QVariantDelegate(QObject* parent = 0);
47  virtual ~QVariantDelegate();
48 
57  QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
58 
64  virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
65 
72  virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
73 
75  virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
76 
77  QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
78 
79 private:
80  void parseEditorHints(QWidget* editor, const QString& editorHints) const;
81 
82  QSignalMapper* m_finishedMapper;
83 };
84 #endif
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
Definition: QVariantDelegate.cpp:101
Definition: QVariantDelegate.h:36
QVariantDelegate(QObject *parent=0)
Definition: QVariantDelegate.cpp:34
virtual ~QVariantDelegate()
Destructor.
Definition: QVariantDelegate.cpp:42
virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
QItemDelegate implementation.
Definition: QVariantDelegate.cpp:128
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const
Definition: QVariantDelegate.cpp:77
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: QVariantDelegate.cpp:46