PDA

View Full Version : How can I show a popup when right mouse button is pressed?



ricardo
13th May 2009, 16:09
Hi mates!

I create a popup menu using QMenu, and my UI have a QTableWidget.
I'd like that if the user press right click over my QTableWidget, this popup shows.

How should I do that?
Using signals/slots, create a new object and rewrrite pressMouseButton...?

Any advice?

Thanks in advance.

Lykurg
13th May 2009, 16:36
Simply use QWidget::customContextMenuRequested(const QPoint &pos) and check if at this position is a cell of your table widget. (see QTableView::indexAt())

ricardo
13th May 2009, 19:01
I got it!

Thanks a lot.