boblatino
21st September 2010, 16:58
When using editorEvent in QItemDelegate, the QStyle::State_Selected doesn't arrive in the editorEvent but it does in paint. I'm using QStyleOptionViewItem.state.
bool InCallItemDelegate::editorEvent(QEvent * event, QAbstractItemModel * model
, const QStyleOptionViewItem & option, const QModelIndex & index )
{
if((option.state & QStyle::State_Selected) == QStyle::State_Selected)
{
//This does not arrive.
}
}
void InCallItemDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
{
if((option.state & QStyle::State_Selected) == QStyle::State_Selected)
{
//This works
}
}
Should I capture the selection in some other way? Could be a QT bug? Im using 4.7.0
Thanks
Ramiro
bool InCallItemDelegate::editorEvent(QEvent * event, QAbstractItemModel * model
, const QStyleOptionViewItem & option, const QModelIndex & index )
{
if((option.state & QStyle::State_Selected) == QStyle::State_Selected)
{
//This does not arrive.
}
}
void InCallItemDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
{
if((option.state & QStyle::State_Selected) == QStyle::State_Selected)
{
//This works
}
}
Should I capture the selection in some other way? Could be a QT bug? Im using 4.7.0
Thanks
Ramiro