Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QListView clicked mouse button

Tags:

qt4

qlistview

I need to know what was the mouse button clicked when a QListView::clicked signal is emitted.

How can I know the button.

like image 487
Jesus Fernandez Avatar asked May 23 '26 06:05

Jesus Fernandez


2 Answers

Try to implements a new class inherit form QListView and re-implement:

void QAbstractItemView::mousePressEvent ( QMouseEvent * event )  [virtual protected].

I hope it's usefull. Salu2

like image 193
Miguel Angel Avatar answered May 25 '26 13:05

Miguel Angel


If you are not interested in subclassing, you can also create an event filter class and install that filter onto the object in which you want to listen to (in this case, the QListView).

For more information look at QObject::installEventFilter().

like image 23
swongu Avatar answered May 25 '26 13:05

swongu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!