QWizard在QMdiArea中表现得很奇怪

时间:2014-09-17 14:19:18

标签: python-3.x pyqt4

我有一个QWizard,它是QMdiArea的子窗口。发生了一些奇怪的事情,但我认为它们都是相关的,所以我将描述最简单的事情。在具有Aero主题的Windows下,以下代码表现很奇怪:

from PyQt4 import QtGui

def createIntroPage():
    page = QtGui.QWizardPage()
    page.setTitle("Introduction")
    label = QtGui.QLabel("This wizard will help you register your copy of "
    "Super Product Two.")
    label.setWordWrap(True)
    layout = QtGui.QVBoxLayout()
    layout.addWidget(label)
    page.setLayout(layout)
    return page

def createRegistrationPage():
    page = QtGui.QWizardPage()
    page.setTitle("Registration")
    page.setSubTitle("Please fill both fields.")
    nameLabel = QtGui.QLabel("Name:")
    nameLineEdit = QtGui.QLineEdit()
    emailLabel = QtGui.QLabel("Email address:")
    emailLineEdit = QtGui.QLineEdit()
    layout = QtGui.QGridLayout()
    layout.addWidget(nameLabel, 0, 0)
    layout.addWidget(nameLineEdit, 0, 1)
    layout.addWidget(emailLabel, 1, 0)
    layout.addWidget(emailLineEdit, 1, 1)
    page.setLayout(layout)
    return page

def createConclusionPage():
    page = QtGui.QWizardPage()
    page.setTitle("Conclusion")
    label = QtGui.QLabel("You are now successfully registered. Have a nice day!")
    label.setWordWrap(True)
    layout = QtGui.QVBoxLayout()
    layout.addWidget(label)
    page.setLayout(layout)
    return page

if __name__ == '__main__':
    import sys
    app = QtGui.QApplication(sys.argv)
    main = QtGui.QMainWindow()
    main.setWindowTitle('Test MDI Application')
    mdiArea = QtGui.QMdiArea(main)
    main.setCentralWidget(mdiArea)

    wizard = QtGui.QWizard(main)
    wizard.addPage(createIntroPage())
    wizard.addPage(createRegistrationPage())
    wizard.addPage(createConclusionPage())
    wizard.setWindowTitle("Trivial Wizard")

    mdiArea.addSubWindow(wizard)
    wizard.show()
    main.show()
    sys.exit(wizard.exec_())

Startup error

注意按钮都缺失了。调整大小后,按钮会出现,但无法单击。它们只能通过标签激活并用空格激活它们。

我做错了什么,或者这是PyQT4问题?

0 个答案:

没有答案