Berryblue031
24th September 2013, 06:59
I am using Qt 5.1.1 and have a QListView with a custom QStyledItemDelegate inside a Widget with the Qt::Popup flag to make a special dropdown in my app.
void MyCustomItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
qDebug() << option.state;
}
On Windows 7 everything works fine and the flags from the QStyleOptionViewItem are as expected, my app renders a nice list that reacts to MouseOver & Selected
..
QStyle::State( "Enabled | Selected" )
QStyle::State( "Enabled" )
QStyle::State( "Enabled | MouseOver" )
QStyle::State( "Enabled" )
...
HOWEVER on Linux and Windows XP the flags are not as expected - MouseOver state is never set and all Items are receiving Active
...
QStyle::State( "Active | Enabled | HasFocus | Selected" )
QStyle::State( "Active | Enabled" )
QStyle::State( "Active | Enabled" )
QStyle::State( "Active | Enabled" )
...
Is this expected? Is there a work around (besides checking if the cursor is within option.rect every time)
void MyCustomItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
qDebug() << option.state;
}
On Windows 7 everything works fine and the flags from the QStyleOptionViewItem are as expected, my app renders a nice list that reacts to MouseOver & Selected
..
QStyle::State( "Enabled | Selected" )
QStyle::State( "Enabled" )
QStyle::State( "Enabled | MouseOver" )
QStyle::State( "Enabled" )
...
HOWEVER on Linux and Windows XP the flags are not as expected - MouseOver state is never set and all Items are receiving Active
...
QStyle::State( "Active | Enabled | HasFocus | Selected" )
QStyle::State( "Active | Enabled" )
QStyle::State( "Active | Enabled" )
QStyle::State( "Active | Enabled" )
...
Is this expected? Is there a work around (besides checking if the cursor is within option.rect every time)