FactDev  0.1
comboboxdelegate.h
1 #ifndef COMBOBOXDELEGATE_H
2 #define COMBOBOXDELEGATE_H
3 #include <QItemDelegate>
4 #include <QComboBox>
5 #include <QApplication>
6 
7 namespace Gui {
8 namespace Widgets {
9 namespace Delegates {
10 
15 class ComboBoxDelegate : public QItemDelegate
16 {
17  Q_OBJECT
18 
19 public:
24  ComboBoxDelegate(QObject* parent=0);
25 
35  virtual QWidget *createEditor(
36  QWidget *parent,
37  const QStyleOptionViewItem &option,
38  const QModelIndex &index) const = 0;
39 
48  void paint(QPainter *painter,
49  const QStyleOptionViewItem &option,
50  const QModelIndex &index) const = 0;
51 
59  void setEditorData(QWidget *editor, const QModelIndex &index) const;
60 
69  void setModelData(QWidget *editor,
70  QAbstractItemModel *model,
71  const QModelIndex &index) const;
72 
81  void updateEditorGeometry(QWidget *editor,
82  const QStyleOptionViewItem &option,
83  const QModelIndex &index) const;
84 
85 };
86 
87 }
88 }
89 }
90 #endif // COMBOBOXDELEGATE_H
virtual QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const =0
ComboBoxDelegate::createEditor Return a ComboBox specified by index item defined by the parent widget...
void setEditorData(QWidget *editor, const QModelIndex &index) const
ComboBoxDelegate::setEditorData Sets the data to be displayed and edited by the editor from the data ...
Definition: comboboxdelegate.cpp:12
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
ComboBoxDelegate::setModelData Gets data from the editor widget and stores it in the specified model ...
Definition: comboboxdelegate.cpp:25
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
ComboBoxDelegate::updateEditorGeometry Update the editor for the item specified by index according to...
Definition: comboboxdelegate.cpp:36
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const =0
ComboBoxDelegate::paint Renders the delegate using the given painter and style option for the item sp...
The ComboBoxDelegate class.
Definition: comboboxdelegate.h:15
ComboBoxDelegate(QObject *parent=0)
ComboBoxDelegate::ComboBoxDelegate Construct a ComboBoxDelegate.
Definition: comboboxdelegate.cpp:7