QWidget not showing after calling show()

雨燕双飞 提交于 2019-12-10 11:28:54

问题


In My App, I have a QWidget which is not showing after I call show(), even though isVisible returns true.

This widget is created from an event of the main application window. But when its started on its own, i.e., as the only widget on an app, it shows up normally.

Anyone knows what may cause this behavior?

Other widgets in my app show up normally only this one is giving me troubles. It actually use to work just fine under a previous version of Qt4 (don't remember which).

the code for the widget is here

update: windows seems to appear and is immediately destroyed.


回答1:


The relevant code is in hidx/GUI/main.py:

@pyqtSignature("")
def on_actionScatterplot_Matrix_activated(self):
    ...
    spm = scatmat.ScatMat(pars, self.currentdbname)
    print "==>", spm.pw.isVisible()
    spm.pw.hide()
    spm.pw.showMaximized()
    print spm.pw.size()
    print "==>", spm.pw.isVisible()

@pyqtSignature("int")
def on_rowStart_valueChanged(self, p0):
    ...

In on_actionScatterplot_Matrix_activated, you create an instance of ScatMat, but don't keep a reference to it. So the window will be briefly shown, and then immediately garbage-collected once the function completes.



来源:https://stackoverflow.com/questions/8242770/qwidget-not-showing-after-calling-show

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!