When using editorEvent in QItemDelegate, the QStyle::State_Selected doesnt arrive
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.
Code:
{
if((option.
state & QStyle::State_Selected) == QStyle::State_Selected) {
//This does not arrive.
}
}
{
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
Re: When using editorEvent in QItemDelegate, the QStyle::State_Selected doesnt arrive
editorEvent() handles many types of events. Some of them have information about selection and some don't.
Re: When using editorEvent in QItemDelegate, the QStyle::State_Selected doesnt arrive
I'm catching all the events in the example provided and I'm selecting a item in the UI. When I do that, the paint is called with the selection but the editorEvent doesn't. What could be happening? Should I register for some type of events like an eventFilter? I need the selection because I'm catching MouseButtonPress, MouseButtonRelease and I need to know if the clicked item is selected (because if its selected I do an action, else I change the selection).
Thanks
Ramiro
Re: When using editorEvent in QItemDelegate, the QStyle::State_Selected doesnt arrive
Quote:
Originally Posted by
boblatino
When I do that, the paint is called with the selection but the editorEvent doesn't.
Let me repeat myself, but only once. editorEvent() handles many types of events, not a particular one. You can't just look at one event which doesn't contain information about selection and say that editorEvent() doesn't have information about selection. Sometimes it does, sometimes it doesn't, it all depends on the type of event it is currently handling. It's a direct equivalent of QObject::event().