View Single Post
Posts: 29 | Thanked: 4 times | Joined on Dec 2009 @ austria
#1
hey there,

I'm wrting a simple gui for a program using eric4, qtdesigner and pyqt4 on maemo. Part of that gui is a Qlistview (http://www.riverbankcomputing.co.uk/...qlistview.html).
Qlistview natively support click and doubleclick signals, allowing me to react on these user actions, ie:

Code:
clicked ( const QModelIndex & index )
This is working fine. However, what I need now is a second signal, different from a simple click, like a right click, to allow more complex user input. A right click on a touchscreen translates to a longer press on the item, right? But event does it translate to? Or how do I code such a custom event?
I have already added a custom signal to react on right clicks/contextMenus:

Code:
#custom right click event
self.listView.setContextMenuPolicy(Qt.CustomContextMenu) self.listView.connect(self.listView, SIGNAL("customContextMenuRequested(QPoint)"), self.onRightClick)
I do get the signal, however, I also get the usual click signal and therefore I cannot react accordingly. Additionally I do lose the index of the item in the list, which I definitely need.

How does one implement "right clicks" correctly without losing the index information and being able to discriminate between the two events?

greetings,
jinx