changed parent of action to qmenu
This commit is contained in:
@ -9,7 +9,6 @@ class RClickMenu(MenuBase):
|
|||||||
|
|
||||||
def __init__(self, obj):
|
def __init__(self, obj):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.obj = obj
|
|
||||||
self.qmenu = QMenu()
|
self.qmenu = QMenu()
|
||||||
obj.setContextMenuPolicy(Qt.CustomContextMenu)
|
obj.setContextMenuPolicy(Qt.CustomContextMenu)
|
||||||
obj.customContextMenuRequested[QPoint].connect(self.on_show)
|
obj.customContextMenuRequested[QPoint].connect(self.on_show)
|
||||||
@ -19,7 +18,7 @@ class RClickMenu(MenuBase):
|
|||||||
self.qmenu.exec(pos)
|
self.qmenu.exec(pos)
|
||||||
|
|
||||||
def addAction(self, name, func):
|
def addAction(self, name, func):
|
||||||
action = QAction(name, triggered=func, parent=self.obj) # here, parent needs to be set
|
action = QAction(name, triggered=func, parent=self.qmenu) # here, parent needs to be set
|
||||||
self.qmenu.addAction(action)
|
self.qmenu.addAction(action)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user