Attachment 'custommenu_subclass.py'
Download 1 #!/usr/bin/env python
2
3 import sys
4 from PyQt4.QtCore import Qt
5 from PyQt4.QtGui import *
6
7 class TableWidget(QTableWidget):
8
9 def __init__(self, parent = None):
10
11 QTableWidget.__init__(self, parent)
12
13 def contextMenuEvent(self, event):
14
15 menu = QMenu(self)
16 quitAction = menu.addAction("Quit")
17 action = menu.exec_(self.mapToGlobal(event.pos()))
18 if action == quitAction:
19 qApp.quit()
20
21
22 app = QApplication([])
23 tableWidget = TableWidget()
24 tableWidget.show()
25 sys.exit(app.exec_())
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.