如何在QWizard中删除帮助(?)?

时间:2018-01-30 11:21:56

标签: python pyqt pyqt4

如何在QWizard窗口中删除该帮助(?)。

示例应用程序Img

编辑:这是代码。这是Qt的简单应用。我只是想禁用它并改为使用帮助按钮。我知道如何在每个页面中添加帮助按钮,但找不到删除帮助(?)选项

的解决方案
from PyQt4.Qt import *


def createIntroPage():
    page = QWizardPage()
    page.setTitle("Introduction")

    label = QLabel("This wizard will help you register your copy of "
            "Super Product Two.")
    label.setWordWrap(True)

    layout = QVBoxLayout()
    layout.addWidget(label)
    page.setLayout(layout)

    return page


def createRegistrationPage():
    page = QWizardPage()
    page.setTitle("Registration")
    page.setSubTitle("Please fill both fields.")

    nameLabel = QLabel("Name:")
    nameLineEdit = QLineEdit()

    emailLabel = QLabel("Email address:")
    emailLineEdit = QLineEdit()

    layout = 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 = QWizardPage()
    page.setTitle("Conclusion")

    label = QLabel("You are now successfully registered. Have a nice day!")
    label.setWordWrap(True)

    layout = QVBoxLayout()
    layout.addWidget(label)
    page.setLayout(layout)
    return page


if __name__ == '__main__':

    import sys

    app = QApplication(sys.argv)

    wizard = QWizard()
    wizard.addPage(createIntroPage())
    wizard.addPage(createRegistrationPage())
    wizard.addPage(createConclusionPage())

    wizard.setWindowTitle("Trivial Wizard")
    wizard.show()

sys.exit(wizard.exec_())

提前致谢

1 个答案:

答案 0 :(得分:2)

您可以使用setWindowFlags()方法停用上下文帮助图标。

self.setWindowFlags(self.windowFlags() | QtCore.Qt.CustomizeWindowHint)
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)

请发布相关代码示例,以便我们为您提供更具体的答案。这只是关于如何禁用按钮的一般概念。

随时问您是否需要了解其他信息。希望它有所帮助:)