pgLab/paramtypedelegate.cpp

30 lines
667 B
C++
Raw Normal View History

#include "paramtypedelegate.h"
#include <QComboBox>
#include "TypeSelectionItemModel.h"
ParamTypeDelegate::ParamTypeDelegate()
: m_typeSelectionModel(new TypeSelectionItemModel)
{}
ParamTypeDelegate::~ParamTypeDelegate()
{
delete m_typeSelectionModel;
}
QWidget *ParamTypeDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
QWidget *w = nullptr;
// if (index.data().canConvert<StarRating>()) {
QComboBox *cmbbx = new QComboBox(parent);
cmbbx->setModel(m_typeSelectionModel);
w = cmbbx;
// } else {
// w = QStyledItemDelegate::createEditor(parent, option, index);
// }
return w;
}