I want to show a QComboBox within specific cells of a QTreeView. I know I have to use an own model for it. The whole thing is already working properly with QIcons shown in the cell, but I fail doing the same with a combobox. That's what my model looks like (some incomplete pseudo-code):
QVariant MyListModel::data(const QModelIndex &index, int role) const
{
...
switch(role)
{
...
case Qt::DecorationRole:
switch(index.column())
{
case eBLA:
// return QIcon(); --> compiles properly
return m_placePosCombos[index.row()]; --> compilation fails
return QComboBox(); --> compilation fails
break;
default:
As soon as I try to return a QComboBox, I get a compilation error
cannot convert from 'const QComboBox' to 'QVariant'
MyListModel inherits from QAbstractListModel.
Any idea what I have to do to use a QComboBox instead of a stupid icon?
Thanks!