when open first time dialog and then closed via keyboard alt+f4
then this will happen
code
# coding:utf-8
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QWidget
from qfluentwidgets import Dialog, setTheme, Theme, PrimaryPushButton
class Demo(QWidget):
def __init__(self, parent=None):
super().__init__(parent=parent)
self.resize(950, 500)
self.btn = PrimaryPushButton('Click Me', parent=self)
self.btn.move(425, 225)
self.btn.clicked.connect(self.showDialog)
self.setStyleSheet('Demo{background:white}')
title = 'Are you sure you want to delete the folder?'
content = """If you delete the "Music" folder from the list, the folder will no longer appear in the list, but will not be deleted."""
self.w = Dialog(title, content, self)
# setTheme(Theme.DARK)
def showDialog(self):
# w.setTitleBarVisible(False)
if self.w.exec():
print('Yes button is pressed')
else:
print('Cancel button is pressed')
if __name__ == '__main__':
# enable dpi scale
QApplication.setHighDpiScaleFactorRoundingPolicy(
Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
app = QApplication(sys.argv)
w = Demo()
w.show()
sys.exit(app.exec_())
when open first time dialog and then closed via keyboard alt+f4 then this will happen
code