PySide.QtGui.QWizardPage class is the base class for wizard pages.
PySide.QtGui.QWizard represents a wizard. Each page is a PySide.QtGui.QWizardPage . When you create your own wizards, you can use PySide.QtGui.QWizardPage directly, or you can subclass it for more control.
A page has the following attributes, which are rendered by PySide.QtGui.QWizard : a PySide.QtGui.QWizardPage.title() , PySide.QtGui.QWizardPage.subTitle() ,和 set of pixmaps 。见 Elements of a Wizard Page for details. Once a page is added to the wizard (using QWizard.addPage() or QWizard.setPage() ), PySide.QtGui.QWizardPage.wizard() returns a pointer to the associated PySide.QtGui.QWizard 对象。
Page provides five virtual functions that can be reimplemented to provide custom behavior:
Normally, the 下一 button and the Finish button of a wizard are mutually exclusive. If PySide.QtGui.QWizardPage.isFinalPage() returns true, Finish is available; otherwise, 下一 is available. By default, PySide.QtGui.QWizardPage.isFinalPage() is true only when PySide.QtGui.QWizardPage.nextId() returns -1. If you want to show 下一 and Final simultaneously for a page (letting the user perform an “early finish”), call setFinalPage(true) on that page. For wizards that support early finishes, you might also want to set the HaveNextButtonOnLastPage and HaveFinishButtonOnEarlyPages options on the wizard.
In many wizards, the contents of a page may affect the default values of the fields of a later page. To make it easy to communicate between pages, PySide.QtGui.QWizard supports a "field" mechanism that allows you to register a field (e.g., a PySide.QtGui.QLineEdit ) on a page and to access its value from any page. Fields are global to the entire wizard and make it easy for any single page to access information stored by another page, without having to put all the logic in PySide.QtGui.QWizard or having the pages know explicitly about each other. Fields are registered using PySide.QtGui.QWizardPage.registerField() and can be accessed at any time using PySide.QtGui.QWizardPage.field() and PySide.QtGui.QWizardPage.setField() .
另请参阅
PySide.QtGui.QWizard 类向导范例 许可向导范例
| 参数: | parent – PySide.QtGui.QWidget |
|---|
Constructs a wizard page with the given parent .
When the page is inserted into a wizard using QWizard.addPage() or QWizard.setPage() , the parent is automatically set to be the wizard.
| 参数: | which – PySide.QtGui.QWizard.WizardButton |
|---|---|
| 返回类型: | unicode |
此虚拟函数被调用由 QWizard.cleanupPage() when the user leaves the page by clicking Back (unless the QWizard.IndependentPages option is set).
The default implementation resets the page's fields to their original values (the values they had before PySide.QtGui.QWizardPage.initializePage() was called).
另请参阅
QWizard.cleanupPage() PySide.QtGui.QWizardPage.initializePage() QWizard.IndependentPages
| 参数: | name – unicode |
|---|---|
| 返回类型: | object |
Returns the value of the field called name .
This function can be used to access fields on any page of the wizard. It is equivalent to calling PySide.QtGui.QWizardPage.wizard() ->``name`` :meth:` <PySide.QtGui.QWizard.field>` ).
范例:
def initializePage(self):
className = field("className")
self.headerLineEdit.setText(className.lower() + ".h")
self.implementationLineEdit.setText(className.lower() + ".cpp")
self.outputDirLineEdit.setText(QDir.convertSeparators(QDir.tempPath()))
此虚拟函数被调用由 QWizard.initializePage() to prepare the page just before it is shown either as a result of QWizard.restart() being called, or as a result of the user clicking 下一 . (However, if the QWizard.IndependentPages option is set, this function is only called the first time the page is shown.)
By reimplementing this function, you can ensure that the page's fields are properly initialized based on fields from previous pages. For example:
def initializePage(self):
className = field("className")
self.headerLineEdit.setText(className.lower() + ".h")
self.implementationLineEdit.setText(className.lower() + ".cpp")
self.outputDirLineEdit.setText(QDir.convertSeparators(QDir.tempPath()))
The default implementation does nothing.
另请参阅
QWizard.initializePage() PySide.QtGui.QWizardPage.cleanupPage() QWizard.IndependentPages
| 返回类型: | PySide.QtCore.bool |
|---|
Returns true if this page is a commit page; otherwise returns false.
| 返回类型: | PySide.QtCore.bool |
|---|
此虚拟函数被调用由 PySide.QtGui.QWizard to determine whether the 下一 or Finish button should be enabled or disabled.
The default implementation returns true if all mandatory fields are filled; otherwise, it returns false.
If you reimplement this function, make sure to emit PySide.QtGui.QWizardPage.completeChanged() , from the rest of your implementation, whenever the value of PySide.QtGui.QWizardPage.isComplete() changes. This ensures that PySide.QtGui.QWizard updates the enabled or disabled state of its buttons. An example of the reimplementation is available here.
| 返回类型: | PySide.QtCore.bool |
|---|
此函数被调用由 PySide.QtGui.QWizard to determine whether the Finish button should be shown for this page or not.
By default, it returns true if there is no next page (i.e., PySide.QtGui.QWizardPage.nextId() returns -1); otherwise, it returns false.
By explicitly calling setFinalPage(true), you can let the user perform an “early finish”.
另请参阅
PySide.QtGui.QWizardPage.isComplete() QWizard.HaveFinishButtonOnEarlyPages
| 返回类型: | PySide.QtCore.int |
|---|
此虚拟函数被调用由 QWizard.nextId() to find out which page to show when the user clicks the 下一 button.
The return value is the ID of the next page, or -1 if no page follows.
By default, this function returns the lowest ID greater than the ID of the current page, or -1 if there is no such ID.
By reimplementing this function, you can specify a dynamic page order. For example:
# class IntroPage
def nextId(self):
if evaluateRadioButton.isChecked():
return LicenseWizard.Page_Evaluate
else:
return LicenseWizard.Page_Register
另请参阅
| 参数: | which – PySide.QtGui.QWizard.WizardPixmap |
|---|---|
| 返回类型: | PySide.QtGui.QPixmap |
| 参数: |
|
|---|
Creates a field called name 关联给定 特性 为给定 widget . From then on, that property becomes accessible using PySide.QtGui.QWizardPage.field() and PySide.QtGui.QWizardPage.setField() .
Fields are global to the entire wizard and make it easy for any single page to access information stored by another page, without having to put all the logic in PySide.QtGui.QWizard or having the pages know explicitly about each other.
若 name ends with an asterisk ( * ), the field is a mandatory field. When a page has mandatory fields, the 下一 and/or Finish buttons are enabled only when all mandatory fields are filled. This requires a changedSignal to be specified, to tell PySide.QtGui.QWizard to recheck the value stored by the mandatory field.
PySide.QtGui.QWizard knows the most common Qt widgets. For these (or their subclasses), you don't need to specify a 特性 或 changedSignal . The table below lists these widgets:
可以使用 QWizard.setDefaultProperty() to add entries to this table or to override existing entries.
To consider a field “filled”, PySide.QtGui.QWizard simply checks that their current value doesn't equal their original value (the value they had before PySide.QtGui.QWizardPage.initializePage() was called). For PySide.QtGui.QLineEdit , it also checks that PySide.QtGui.QLineEdit.hasAcceptableInput() returns true, to honor any validator or mask.
PySide.QtGui.QWizard ‘s mandatory field mechanism is provided for convenience. It can be bypassed by reimplementing QWizardPage.isComplete() .
| 参数: |
|
|---|
| 参数: | commitPage – PySide.QtCore.bool |
|---|
Sets this page to be a commit page if commitPage is true; otherwise, sets it to be a normal page.
A commit page is a page that represents an action which cannot be undone by clicking Back or Cancel .
A Commit button replaces the 下一 button on a commit page. Clicking this button simply calls QWizard.next() just like clicking 下一 does.
A page entered directly from a commit page has its Back button disabled.
| 参数: |
|
|---|
Sets the value of the field called name to value .
This function can be used to set fields on any page of the wizard. It is equivalent to calling PySide.QtGui.QWizardPage.wizard() ->``name`` :meth:` <PySide.QtGui.QWizard.setField>` , value ).
| 参数: | finalPage – PySide.QtCore.bool |
|---|
Explicitly sets this page to be final if finalPage 为 true。
After calling setFinalPage(true), PySide.QtGui.QWizardPage.isFinalPage() returns true and the Finish button is visible (and enabled if PySide.QtGui.QWizardPage.isComplete() returns true).
After calling setFinalPage(false), PySide.QtGui.QWizardPage.isFinalPage() returns true if PySide.QtGui.QWizardPage.nextId() returns -1; otherwise, it returns false.
另请参阅
PySide.QtGui.QWizardPage.isFinalPage() PySide.QtGui.QWizardPage.isComplete() QWizard.HaveFinishButtonOnEarlyPages
| 参数: |
|
|---|
| 参数: | subTitle – unicode |
|---|
This property holds the subtitle of the page.
The subtitle is shown by the PySide.QtGui.QWizard , between the title and the actual page. Subtitles are optional. In ClassicStyle and ModernStyle , using subtitles is necessary to make the header appear. In MacStyle , the subtitle is shown as a text label just above the actual page.
The subtitle may be plain text or HTML, depending on the value of the QWizard.subTitleFormat 特性。
默认情况下,此特性包含空字符串。
另请参阅
PySide.QtGui.QWizardPage.title() QWizard.IgnoreSubTitles Elements of a Wizard Page
| 参数: | title – unicode |
|---|
This property holds the title of the page.
The title is shown by the PySide.QtGui.QWizard , above the actual page. All pages should have a title.
The title may be plain text or HTML, depending on the value of the QWizard.titleFormat 特性。
默认情况下,此特性包含空字符串。
另请参阅
PySide.QtGui.QWizardPage.subTitle() Elements of a Wizard Page
| 返回类型: | unicode |
|---|
This property holds the subtitle of the page.
The subtitle is shown by the PySide.QtGui.QWizard , between the title and the actual page. Subtitles are optional. In ClassicStyle and ModernStyle , using subtitles is necessary to make the header appear. In MacStyle , the subtitle is shown as a text label just above the actual page.
The subtitle may be plain text or HTML, depending on the value of the QWizard.subTitleFormat 特性。
默认情况下,此特性包含空字符串。
另请参阅
PySide.QtGui.QWizardPage.title() QWizard.IgnoreSubTitles Elements of a Wizard Page
| 返回类型: | unicode |
|---|
This property holds the title of the page.
The title is shown by the PySide.QtGui.QWizard , above the actual page. All pages should have a title.
The title may be plain text or HTML, depending on the value of the QWizard.titleFormat 特性。
默认情况下,此特性包含空字符串。
另请参阅
PySide.QtGui.QWizardPage.subTitle() Elements of a Wizard Page
| 返回类型: | PySide.QtCore.bool |
|---|
此虚拟函数被调用由 QWizard.validateCurrentPage() when the user clicks 下一 or Finish to perform some last-minute validation. If it returns true, the next page is shown (or the wizard finishes); otherwise, the current page stays up.
The default implementation returns true.
When possible, it is usually better style to disable the 下一 or Finish button (by specifying mandatory fields or reimplementing PySide.QtGui.QWizardPage.isComplete() ) than to reimplement PySide.QtGui.QWizardPage.validatePage() .
| 返回类型: | PySide.QtGui.QWizard |
|---|
Returns the wizard associated with this page, or 0 if this page hasn't been inserted into a PySide.QtGui.QWizard yet.