Disable wheel event for a QComboBox inside a QListWidgetItem
Hello all,
I am using a QTablewidget with different widgets in different columns. The trouble begins when there are more rows to fit the view and you need to scroll. One of the columns is holding a QComboBox and when you use the scroll wheel and your mouse happens to be over a column with a QComboBox you scroll the QComboBox instead of the table view. I tried setting:
Code:
combbbox->setFocusPolicy(Qt::TabFocus);
but it does not help.
Any suggestion of how to make it react to a scroll wheel only when it already has focus?
Markus
Re: Disable wheel event for a QComboBox inside a QListWidgetItem
Why not override the mouse wheel event with event->ignore() ?
Re: Disable wheel event for a QComboBox inside a QListWidgetItem
I expect that reimplementing the QComboBox::wheelEvent() to look something like this would be a start (untested):
Code:
{
if (hasFocus())
else
e->ignore();
}
Re: Disable wheel event for a QComboBox inside a QListWidgetItem
Thanks, sub-classing will work. I was wondering if there is another way.
Re: Disable wheel event for a QComboBox inside a QListWidgetItem
The cleaner approach is to do the override event handling in a subclass, but you can always install an event filter instead.
See QObject::eventFilter()
Cheers,
_