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.
{
qDebug() << option.state;
}
void MyCustomItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
qDebug() << option.state;
}
To copy to clipboard, switch view to plain text mode
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 | MouseOver" ) ...
..
QStyle::State( "Enabled | Selected" )
QStyle::State( "Enabled" )
QStyle::State( "Enabled | MouseOver" )
QStyle::State( "Enabled" )
...
To copy to clipboard, switch view to plain text mode
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" ) ...
...
QStyle::State( "Active | Enabled | HasFocus | Selected" )
QStyle::State( "Active | Enabled" )
QStyle::State( "Active | Enabled" )
QStyle::State( "Active | Enabled" )
...
To copy to clipboard, switch view to plain text mode
Is this expected? Is there a work around (besides checking if the cursor is within option.rect every time)
Bookmarks