Closed rllysleepy closed 1 year ago
Describe the bug When creating a new dialog window, setting the style will cause the stylesheets of main window to reset.
Environment 环境信息
To Reproduce See code.
Code 最小复现代码
import sys from PyQt6.QtCore import * from PyQt6.QtGui import * from PyQt6.QtWidgets import * from qfluentwidgets import * from qframelesswindow import * class dialog(QDialog, AcrylicWindow): def __init__(self): super().__init__() setTheme(Theme.DARK) class MainWindow(QMainWindow): def __init__(self): super().__init__() setTheme(Theme.DARK) container=QWidget() layout=QVBoxLayout() self.setStyleSheet("background-color: #303030;") button=PushButton("open new window") button.setStyleSheet("background-color: red;") button.clicked.connect(self.newDialog) container.setLayout(layout) layout.addWidget(button) self.setCentralWidget(container) def newDialog(self): newdialog=dialog() newdialog.show() app = QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec())
Expected behavior Stylesheet of main window should be left alone.
Screenshots If applicable, add screenshots to help explain your problem.
The scope of setTheme is global and cannot be applied separately to a component. If you want to apply a style to a component separately, you need to call FluentStyleSheet.DIALOG.apply(dialog, Theme.DARK)
setTheme
FluentStyleSheet.DIALOG.apply(dialog, Theme.DARK)
Describe the bug When creating a new dialog window, setting the style will cause the stylesheets of main window to reset.
Environment 环境信息
To Reproduce See code.
Code 最小复现代码
Expected behavior Stylesheet of main window should be left alone.
Screenshots If applicable, add screenshots to help explain your problem.