wumu
2024-05-09 9ddb25babb774f773b62106fb4d1a9404af71fd9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef COMBOBOXDELEGATE_H
#define COMBOBOXDELEGATE_H
 
#include <QItemDelegate>
#include <QComboBox>
 
 
class ComboBoxDelegate : public QItemDelegate
{
public:
    ComboBoxDelegate(QStringList labels,QObject *parent=0);
 
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
    void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
 
private:
    QStringList m_labels;
};
 
#endif // COMBOBOXDELEGATE_H