QSqlTableModel + QStyledItemDelegate already implemented , Now I need to add mouse Event (Right Click). Help Required
-
Hi.
I have already implemented a QStyledItemDelgate to show images in my QTableview. The styleditem delegate display images and also provide a mechanism for text entry (QLineEdit, QDateEdit and QComboBox)Now I need to implement a mechanism to detect a right click in my QTableView, so that I can display a drop down menu. This is where i am running into problems.
I tried the following approach.
Approach 1
Sub classed a QTableView and added QMouse event and was able to detect the left click and right click. But when i double click I am unable to get the delegate action to work.
Approach 2 :
I came across that in QStyledItem Delegate we can use bool editorEvent(); but the clicks on a particular column are not detecting.Please suggest which approach is best, and how to implement them.
Thanks
-
Hi,
You might be interested by "contextMenuEvent":http://qt-project.org/doc/qt-5/qwidget.html#contextMenuEvent and related classes
Hope it helps