mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
fix compatibility of QAction in Publisher
This commit is contained in:
parent
02a895042d
commit
c2b2dbb3f3
1 changed files with 12 additions and 8 deletions
|
|
@ -250,21 +250,25 @@ class PublishReportBtn(PublishIconBtn):
|
|||
self._actions = []
|
||||
|
||||
def add_action(self, label, identifier):
|
||||
action = QtWidgets.QAction(label)
|
||||
action.setData(identifier)
|
||||
action.triggered.connect(
|
||||
functools.partial(self._on_action_trigger, action)
|
||||
self._actions.append(
|
||||
(label, identifier)
|
||||
)
|
||||
self._actions.append(action)
|
||||
|
||||
def _on_action_trigger(self, action):
|
||||
identifier = action.data()
|
||||
def _on_action_trigger(self, identifier):
|
||||
self.triggered.emit(identifier)
|
||||
|
||||
def mouseReleaseEvent(self, event):
|
||||
super(PublishReportBtn, self).mouseReleaseEvent(event)
|
||||
menu = QtWidgets.QMenu(self)
|
||||
menu.addActions(self._actions)
|
||||
actions = []
|
||||
for item in self._actions:
|
||||
label, identifier = item
|
||||
action = QtWidgets.QAction(label, menu)
|
||||
action.triggered.connect(
|
||||
functools.partial(self._on_action_trigger, identifier)
|
||||
)
|
||||
actions.append(action)
|
||||
menu.addActions(actions)
|
||||
menu.exec_(event.globalPos())
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue