How to create a blur/grey out effect animation over MainWindow while opening/editing a DialogWindow?

40 views Asked by At

I'm doing a PyQt5 GUI application. I'd like to have a blur/grey out effect animation appearing over a MainWindow while opening/editing a DialogWindow. In resume, I'd like to achieve this effect.

I have already tried to setEnable(True) and make the dialog modal while opening it. But both windows get stuck and I don't have the wanted blur/grey out effect.

def open_importing_dialog(self):
    self.importing = ImportingData(self)
    self.setEnabled(False)
    self.repaint()
    self.importing.setEnabled(True)
    self.importing.setWindowFlag(Qt.WindowStaysOnTopHint)
    self.importing.finished.connect(lambda: self.setEnabled(True))
    self.importing.show()

And tried to make a overlay widget with QGraphicsBlurEffect, but nothing happened.

def open_importing_dialog(self):
    blur = QtWidgets.QGraphicsBlurEffect()
    blur.setBlurRadius(10)
    blur_overlay = QWidget(self)
    blur_overlay.setGraphicsEffect(blur)
    blur_overlay.setGeometry(self.geometry())
    self.importing = ImportingData(self)
    self.importing.exec_()

Could you help me in this issue? Or even give me some tips to achieve it? Appreciate!

(Obs.: I have a link from YouTube showing how this effect works, but I don't know if I can drop external links here. If it's okay, I could drop it in a comment for you to have a better idea how is this effect I want)

0

There are 0 answers