PySide6向导页首个按钮呈蓝色的原因排查
为何QWizard中的首个按钮会呈现蓝色?
说明:我承认这可能是重复问题,但个人认为它被标记为错误问题的重复项,更合适的参考问题是关于PyQt5程序中首个按钮变蓝的相关问题。
import sys from PySide6.QtWidgets import QApplication, QWidget, QPushButton, QHBoxLayout, QWizard, QWizardPage class ThreeButtonsPage(QWizardPage): def __init__(self): super().__init__() self.initUI() def initUI(self): button1 = QPushButton('Button 1', self) button2 = QPushButton('Button 2', self) button3 = QPushButton('Button 3', self) hbox = QHBoxLayout() hbox.addWidget(button1) hbox.addWidget(button2) hbox.addWidget(button3) self.setLayout(hbox) class MyWizard(QWizard): def __init__(self): super().__init__() first_page = ThreeButtonsPage() self.addPage(first_page) self.setWindowTitle('Wizard Example') if __name__ == '__main__': app = QApplication(sys.argv) wizard = MyWizard() wizard.show() sys.exit(app.exec())
问题详情
为何首个按钮呈蓝色?我提供的代码逻辑清晰,仅首个按钮显示为蓝色。我已排查所有按钮的样式,确认这并非样式问题;且将相同布局用于普通窗口时无此问题,因此该问题似乎是QWizard特有的。

内容的提问来源于stack exchange,提问作者Keeely
相关产品推荐
相关产品推荐

