【发布时间】:2018-07-15 13:30:13
【问题描述】:
我正在使用 PyQt5 和 Python3 编写程序。 当显示弹出窗口时,我正在使用 QGraphicsBlurEffect 在主小部件上制作模糊效果。 问题是,当弹出窗口关闭时,模糊效果仍在主窗口小部件上,并且不会正常显示。关闭弹窗后如何设置为正常?(我在弹窗关闭事件中将mainwindow的graphicsEffect设置为None,但没有任何改变)。
这是代码:
主小部件:
self.blureffect = QGraphicsBlurEffect(self) #defining the effect
def fontpgshow(self): #shows the popup window
self.setGraphicsEffect(self.blureffect) #puts the blur effect on the main widget
#the 3 bottom lines show the popup window
import fontwindow
self.fontpg = fontwindow.fontpage()
self.fontpg.show()
弹出窗口:
def closeEvent(self,event):
event.accept()
#in the bottom lines I set the effect of main window to None
import settingswindow
self.setpg = settingswindow.settingspage()
self.setpg.setGraphicsEffect(None)
【问题讨论】:
-
@eyllanesc 有很多代码我不能全部放在这里。你可以看到我的问题是这样的:“在 PyQt 中使用 QGraphicsBlurEffect 的正确方法是什么?
-
您确定
self.setpg指的是正确的QWidget--self.setpg.graphicsEffect()返回什么?否则,显示的代码没有任何明显错误。 -
@G.M.是的,它指的是“设置页面”,这是一个 QWidget,它就像我在软件中的设置页面一样。在设置图形效果之前它返回 None 之后它返回 `
.
标签: python-3.x qt5 pyqt5