Commit 5079e3f2 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[widgets] Add parent to QMenu

Issue found when testing with PySide2.

From the documentation, QPushButton::setMenu
does not take ownership of the menu. With PySide2,
the menu is garbage collected but the actions
created from it are not completely destroyed as
it seems. Giving the menu a proper parent ensure
that its lifetime is correctly handled.
parent 9afc8722
...@@ -161,7 +161,7 @@ class AssetWidget(QWidget): ...@@ -161,7 +161,7 @@ class AssetWidget(QWidget):
layout.addWidget(self.asset_name_label) layout.addWidget(self.asset_name_label)
layout.addWidget(self.tab_widget) layout.addWidget(self.tab_widget)
edit_menu = QMenu() edit_menu = QMenu(self)
self.edit_code_action = edit_menu.addAction(self.tr("Code")) self.edit_code_action = edit_menu.addAction(self.tr("Code"))
self.edit_documentation_action = edit_menu.addAction(self.tr("Documentation")) self.edit_documentation_action = edit_menu.addAction(self.tr("Documentation"))
......
...@@ -65,7 +65,7 @@ def create_add_button_layout(): ...@@ -65,7 +65,7 @@ def create_add_button_layout():
add_pushbutton = QPushButton(QCoreApplication.translate("Dataformat", "Add")) add_pushbutton = QPushButton(QCoreApplication.translate("Dataformat", "Add"))
add_menu = QMenu() add_menu = QMenu(add_pushbutton)
add_type_action = add_menu.addAction( add_type_action = add_menu.addAction(
QCoreApplication.translate("Dataformat", "Type") QCoreApplication.translate("Dataformat", "Type")
) )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment