Skip to content

Commit 93b7515

Browse files
authored
Merge pull request #216 from j8xixo12/fix_runtime_error
add Qt main window module level handler in view module
2 parents 8559272 + da2dc60 commit 93b7515

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

modmesh/view.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@
5252
try:
5353
from _modmesh import view as _vimpl # noqa: F401
5454
enable = True
55+
# Before using _modmesh mianWindow api, the QMainWindow signature need
56+
# to be imported or will get type error:
57+
# TypeError: Unable to convert function return value to a Python type!
58+
# Creating variable to handle Qt MainWindow which is created by c++ and
59+
# registered it to Shiboken6 to prevent runtime error occured:
60+
# RuntimeError:
61+
# Internal C++ object (PySide6.QtGui.QWindow) already deleted.
62+
from PySide6.QtWidgets import QMainWindow # noqa: F401
63+
_main_window = _vimpl.RManager.instance.mainWindow
5564
except ImportError:
5665
pass
5766

0 commit comments

Comments
 (0)