so i've been sniffing around..
i found my solution, but a part of it is showing a combo box at all times by reimplementing paint event in my delegate:
void polly
::RootDelegate::paint(QPainter *painter,
{
if ( index.data().canConvert<ComboBoxData>() )
{
polly::ComboBoxData d = index.data().value<polly::ComboBoxData>();
box.currentText = d._items.at( d._selected ) ;
box.rect = option.rect;
box.editable = true;
&box, painter);
} else
QStyledItemDelegate::paint(painter, option, index);
}
void polly::RootDelegate::paint(QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
if ( index.data().canConvert<ComboBoxData>() )
{
polly::ComboBoxData d = index.data().value<polly::ComboBoxData>();
QStyleOptionComboBox box;
box.currentText = d._items.at( d._selected ) ;
box.rect = option.rect;
box.editable = true;
box.state = QStyle::State_Active & QStyle::State_Enabled;
QApplication::style()->drawComplexControl(QStyle::CC_ComboBox,
&box, painter);
} else
QStyledItemDelegate::paint(painter, option, index);
}
To copy to clipboard, switch view to plain text mode
problem now is that the "fake" combo box always turns out gray (disabled) and without text.. what did i do wrong?
Bookmarks