Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在houdini中实例化MDivider错误 #38

Open
zuokangbo opened this issue Apr 20, 2022 · 4 comments
Open

在houdini中实例化MDivider错误 #38

zuokangbo opened this issue Apr 20, 2022 · 4 comments

Comments

@zuokangbo
Copy link

Describe the bug
实例化的时候出现如下错误
RuntimeError: Internal C++ object (PySide2.QtWidgets.QProxyStyle) already deleted.
image

houdini版本:19.0.531

@Wenfeng-Zhang
Copy link

同样遇到了这个错误,在houdini里如果使用了label.py里MLabel这个函数,MLabel()后面不能加.h1()或者.secondary()之类的方法,会导致报错。而nuke、maya不会报错但是不执行这些方法。 UE调用机制不同目前没发现,其它DCC没有测试,应该也是同样的错误。 查过是因为在DCC里面执行MLabel(),这个里面的.polish(self)调用自己本身是不行的。不在DCC里运行这些GUI没问题。

@muyr
Copy link
Contributor

muyr commented Jul 19, 2022

收到,排查中

@muyr
Copy link
Contributor

muyr commented Jul 19, 2022

貌似当widget没有指定过 StyleSheet时,在houdini和 3ds MAX中,调用widget.style() 会报 RuntimeError: Internal C++ object (PySide2.QtWidgets.QProxyStyle) already deleted.
企业微信截图_16582304561328

可能是这俩DCC 的内部什么机制吧
企业微信截图_16582314326091

我再研究研究怎么绕过去

@muyr
Copy link
Contributor

muyr commented Jul 19, 2022

暂时可以这么做:
dayu_theme.apply 移动到你的主窗口的 __init__ 函数中,并放置在所有子组件初始化之前

from Qt import QtWidgets

from dayu_widgets import MLabel, MDivider
from dayu_widgets import dayu_theme


class MyWidget(QtWidgets.QWidget):
    def __init__(self, parent=None):
        super(MyWidget, self).__init__(parent)
        # MOVE TO HERE ########
        dayu_theme.apply(self)
        #####################
        main_lay = QtWidgets.QVBoxLayout()
        self.setLayout(main_lay)
        main_lay.addWidget(MDivider("test"))
        main_lay.addWidget(MLabel("test").h1().secondary())

test = MyWidget()
# dayu_theme.apply(test)
test.show()

这样可以暂时缓解报错的问题。

但并无法根治,据测试,还是会偶发的引起崩溃,属实是目前我解决不了的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants