a517a3e67ece660e06c49cfb73bab71517677084
[emufront] / src / delegates / comboboxdelegate.h
1 #ifndef COMBOBOXDELEGATE_H
2 #define COMBOBOXDELEGATE_H
3
4 #include <QStyledItemDelegate>
5
6 class EmuFrontQueryModel;
7
8 class ComboBoxDelegate : public QStyledItemDelegate
9 {
10     Q_OBJECT
11 public:
12     ComboBoxDelegate(int column, EmuFrontQueryModel *, QWidget *parent = 0);
13     void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
14     //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
15     QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
16     void setEditorData(QWidget *editor, const QModelIndex &index) const;
17     void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
18
19 private slots:
20     void commitAndCloseEditor();
21 private:
22     EmuFrontQueryModel *model;
23     int column;
24 };
25
26 #endif // COMBOBOXDELEGATE_H