![]() |
2010-10-19
, 13:43
|
|
Posts: 2,853 |
Thanked: 968 times |
Joined on Nov 2005
|
#2
|
The Following User Says Thank You to fpp For This Useful Post: | ||
![]() |
2010-10-19
, 18:27
|
Posts: 29 |
Thanked: 4 times |
Joined on Dec 2009
@ austria
|
#3
|
![]() |
2010-10-20
, 15:36
|
Posts: 29 |
Thanked: 4 times |
Joined on Dec 2009
@ austria
|
#4
|
![]() |
2010-10-22
, 22:22
|
|
Posts: 2,448 |
Thanked: 9,523 times |
Joined on Aug 2010
@ Wigan, UK
|
#5
|
self.listWidget.setContextMenuPolicy(Qt.ActionsContextMenu)
self.actionEdit = QAction("Edit", self.listWidget) self.actionDelete = QAction("Delete", self.listWidget) self.listWidget.addAction(self.actionEdit) self.listWidget.addAction(self.actionDelete)
self.connect(self.actionEdit, SIGNAL("triggered()"), self.testMethod) def testMethod(self):row = self.listWidget.currentRow() print row
![]() |
2010-10-23
, 13:35
|
Posts: 29 |
Thanked: 4 times |
Joined on Dec 2009
@ austria
|
#6
|
on left click on a list item - do action 1 on right click on a list item - do action 2 (no action menu, just do action 2)
on left click: play song on right click: show id3 information
#custom right click event self.right = False self.listView.setContextMenuPolicy(Qt.CustomContextMenu) self.listView.connect(self.listView, SIGNAL("customContextMenuRequested(QPoint)"), self.onRightClick)
def onRightClick(self): self.right = True
def on_listView_clicked(self, index): if self.right: action1 else: action2
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:
I have already added a custom signal to react on right clicks/contextMenus:
How does one implement "right clicks" correctly without losing the index information and being able to discriminate between the two events?
greetings,
jinx