Solved Any way to stop QListView reacting to ANY mouse button without subclassing?
-
It seems quite counter-intuitive to me, that QListView treats any mouse button as the left button - for example, in most applications, middle mouse button is used to scroll the view, but QListView reacts with selecting an item. And it does the same if I press mouse buttons 4 and 5, which is even more unnecessary thing to do.
Of course I could derive my own class and override mousePressEvent - but is there another option? Something in the QAbstractItemView perhaps?
-
Hi,
You can use an event filter for example.
-
Hmm, this still feels a bit weird, but at least solves the problem.
One thing to add: in case of QListView or QTreeView, the event filter should be installed not on the widget itself, but on its viewport.