<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # QFormLayout Class Reference ## [[QtGui](index.htm) module] 該QFormLayout類管理輸入部件及其關聯的標籤形式。[More...](#details) 繼承[QLayout](qlayout.html)。 ### Types * `enum FieldGrowthPolicy { FieldsStayAtSizeHint, ExpandingFieldsGrow, AllNonFixedFieldsGrow }` * `enum ItemRole { LabelRole, FieldRole, SpanningRole }` * `enum RowWrapPolicy { DontWrapRows, WrapLongRows, WrapAllRows }` ### Methods * `__init__ (self, QWidget?parent?=?None)` * `addItem (self, QLayoutItem?item)` * `addRow (self, QWidget?label, QWidget?field)` * `addRow (self, QWidget?label, QLayout?field)` * `addRow (self, QString?labelText, QWidget?field)` * `addRow (self, QString?labelText, QLayout?field)` * `addRow (self, QWidget?widget)` * `addRow (self, QLayout?layout)` * `int count (self)` * `Qt.Orientations expandingDirections (self)` * `FieldGrowthPolicy fieldGrowthPolicy (self)` * `Qt.Alignment formAlignment (self)` * `(int?rowPtr, ItemRole?rolePtr) getItemPosition (self, int?index)` * `(int?rowPtr, ItemRole?rolePtr) getLayoutPosition (self, QLayout?layout)` * `(int?rowPtr, ItemRole?rolePtr) getWidgetPosition (self, QWidget?widget)` * `bool hasHeightForWidth (self)` * `int heightForWidth (self, int?width)` * `int horizontalSpacing (self)` * `insertRow (self, int?row, QWidget?label, QWidget?field)` * `insertRow (self, int?row, QWidget?label, QLayout?field)` * `insertRow (self, int?row, QString?labelText, QWidget?field)` * `insertRow (self, int?row, QString?labelText, QLayout?field)` * `insertRow (self, int?row, QWidget?widget)` * `insertRow (self, int?row, QLayout?layout)` * `invalidate (self)` * `QLayoutItem itemAt (self, int?row, ItemRole?role)` * `QLayoutItem itemAt (self, int?index)` * `Qt.Alignment labelAlignment (self)` * `QWidget labelForField (self, QWidget?field)` * `QWidget labelForField (self, QLayout?field)` * `QSize minimumSize (self)` * `int rowCount (self)` * `RowWrapPolicy rowWrapPolicy (self)` * `setFieldGrowthPolicy (self, FieldGrowthPolicy?policy)` * `setFormAlignment (self, Qt.Alignment?alignment)` * `setGeometry (self, QRect?rect)` * `setHorizontalSpacing (self, int?spacing)` * `setItem (self, int?row, ItemRole?role, QLayoutItem?item)` * `setLabelAlignment (self, Qt.Alignment?alignment)` * `setLayout (self, int?row, ItemRole?role, QLayout?layout)` * `setRowWrapPolicy (self, RowWrapPolicy?policy)` * `setSpacing (self, int)` * `setVerticalSpacing (self, int?spacing)` * `setWidget (self, int?row, ItemRole?role, QWidget?widget)` * `QSize sizeHint (self)` * `int spacing (self)` * `QLayoutItem takeAt (self, int?index)` * `int verticalSpacing (self)` * * * ## Detailed Description 該QFormLayout類管理輸入部件及其關聯的標籤形式。 QFormLayout是勾畫出它在一個兩列的表格孩子一個方便的布局類。左欄包括標籤,右列包含“場”的小部件(行編輯器,旋轉框等) 。 傳統上,這樣的兩欄式布局形式采用實現[QGridLayout](qgridlayout.html)。 QFormLayout是更高級別的替代方案,提供了以下優點: * **Adherence to the different platform's look and feel guidelines.** 例如,本 [Mac OS X Aqua](http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGIntro/chapter_1_section_1.html)和KDE指引指定的標籤應該是右對齊的,而Windows和GNOME應用程序通常使用左對齊。 * **Support for wrapping long rows.** 對于具有小顯示器的設備, QFormLayout可以設置為[wrap long rows](qformlayout.html#RowWrapPolicy-enum)或什至[wrap all rows](qformlayout.html#RowWrapPolicy-enum)。 * **Convenient API for creating label--field pairs.** 該[addRow](qformlayout.html#addRow)( )重載采用一個[QString](qstring.html)和[QWidget](qwidget.html)*創建一個[QLabel](qlabel.html)在幕后,并自動設置其為好友。然后,我們可以編寫這樣的代碼: ``` QFormLayout *formLayout = new QFormLayout; formLayout-&gt;addRow(tr("&Name:"), nameLineEdit); formLayout-&gt;addRow(tr("&Email:"), emailLineEdit); formLayout-&gt;addRow(tr("&Age:"), ageSpinBox); setLayout(formLayout); ``` 使用下面的代碼,寫的比較這[QGridLayout](qgridlayout.html): ``` nameLabel = new [QLabel](qlabel.html)(tr("&Name:")); nameLabel-&gt;setBuddy(nameLineEdit); emailLabel = new [QLabel](qlabel.html)(tr("&Name:")); emailLabel-&gt;setBuddy(emailLineEdit); ageLabel = new [QLabel](qlabel.html)(tr("&Name:")); ageLabel-&gt;setBuddy(ageSpinBox); [QGridLayout](qgridlayout.html) *gridLayout = new [QGridLayout](qgridlayout.html); gridLayout-&gt;addWidget(nameLabel, 0, 0); gridLayout-&gt;addWidget(nameLineEdit, 0, 1); gridLayout-&gt;addWidget(emailLabel, 1, 0); gridLayout-&gt;addWidget(emailLineEdit, 1, 1); gridLayout-&gt;addWidget(ageLabel, 2, 0); gridLayout-&gt;addWidget(ageSpinBox, 2, 1); setLayout(gridLayout); ``` 下表顯示了默認的外觀在不同的風格。 | [QCommonStyle](qcommonstyle.html) derived styles (except [QPlastiqueStyle](index.htm)) | [QMacStyle](index.htm) | [QPlastiqueStyle](index.htm) | Qt Extended styles | | --- | --- | --- | --- | | ![](https://img.kancloud.cn/82/22/8222e95a0c4ddf43770ec813b3c5827c_258x140.png) | ![](https://img.kancloud.cn/69/6b/696bdc439fb76d254c90fee0c85daeb5_258x140.png) | ![](https://img.kancloud.cn/8b/39/8b3917b7fb6d3ce30d49309909885991_258x140.png) | ![](https://img.kancloud.cn/aa/15/aa1508335cc510b4e01c9e32ebc468c7_258x140.png) | | Traditional style used for Windows, GNOME, and earlier versions of KDE. Labels are left aligned, and expanding fields grow to fill the available space. (This normally corresponds to what we would get using a two-column [QGridLayout](qgridlayout.html).) | Style based on the [Mac OS X Aqua](http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGIntro/chapter_1_section_1.html) guidelines. Labels are right-aligned, the fields don't grow beyond their size hint, and the form is horizontally centered. | Recommended style for [KDE applications](http://www.kdedevelopers.org/node/2345). Similar to MacStyle, except that the form is left-aligned and all fields grow to fill the available space. | Default style for Qt Extended styles. Labels are right-aligned, expanding fields grow to fill the available space, and row wrapping is enabled for long lines. | 表格樣式可以也可以單獨通過調用被重寫[setLabelAlignment](qformlayout.html#labelAlignment-prop)( )[setFormAlignment](qformlayout.html#formAlignment-prop)( )[setFieldGrowthPolicy](qformlayout.html#fieldGrowthPolicy-prop)()和[setRowWrapPolicy](qformlayout.html#rowWrapPolicy-prop)( ) 。例如,以模擬的形式布局美觀[QMacStyle](index.htm)在所有平臺上,但左對齊的標籤,你可以這樣寫: ``` formLayout->setRowWrapPolicy(QFormLayout.DontWrapRows); formLayout->setFieldGrowthPolicy(QFormLayout.FieldsStayAtSizeHint); formLayout->setFormAlignment([Qt](qt.html).AlignHCenter | [Qt](qt.html).AlignTop); formLayout->setLabelAlignment([Qt](qt.html).AlignLeft); ``` * * * ## Type Documentation ``` QFormLayout.FieldGrowthPolicy ``` 該枚舉指定可以被用來控制在該表單的字段成長的方式,不同的政策。 | Constant | Value | Description | | --- | --- | --- | | `QFormLayout.FieldsStayAtSizeHint` | `0` | 這些字段永遠長不大超出了他們的[effective size hint](qwidgetitem.html#sizeHint)。這是默認的[QMacStyle](index.htm)。 | | `QFormLayout.ExpandingFieldsGrow` | `1` | 與橫向領域[size policy](qsizepolicy.html)的[Expanding](qsizepolicy.html#Policy-enum) or [MinimumExpanding](qsizepolicy.html#Policy-enum)將增長到填滿可用空間。其他欄位不得超出其有效尺寸暗示。這是PLASTIQUE的默認策略。 | | `QFormLayout.AllNonFixedFieldsGrow` | `2` | 用大小政策,使他們能夠成長各個領域將增長到填滿可用空間。這是大多數款式的默認策略。 | **See also** [fieldGrowthPolicy](qformlayout.html#fieldGrowthPolicy-prop)。 ``` QFormLayout.ItemRole ``` 此枚舉指定部件(或其他布局項目)的類型,可能會出現一排。 | Constant | Value | Description | | --- | --- | --- | | `QFormLayout.LabelRole` | `0` | 一個標籤控件。 | | `QFormLayout.FieldRole` | `1` | 字段部件。 | | `QFormLayout.SpanningRole` | `2` | 一個小部件,跨越標籤和字段列。 | **See also** [itemAt](qformlayout.html#itemAt)()和[getItemPosition](qformlayout.html#getItemPosition)( ) 。 ``` QFormLayout.RowWrapPolicy ``` 該枚舉指定可以被用來控制在該表格中的行包的方式,不同的政策。 | Constant | Value | Description | | --- | --- | --- | | `QFormLayout.DontWrapRows` | `0` | 字段總是奠定了旁邊的標籤。這是除了Qt的擴展風格的缺省策略為所有的風格和[QS60Style](index.htm)。 | | `QFormLayout.WrapLongRows` | `1` | 標籤被給予足夠的水平空間,以適應寬的標籤,并且該空間的剩馀部分被提供給字段。如果一個場對的最小尺寸大于可用空間更寬,該字段被換到下一行。這是為Qt擴展的風格和和默認策略[QS60Style](index.htm)。 | | `QFormLayout.WrapAllRows` | `2` | 字段總是布置下他們的標籤。 | **See also** [rowWrapPolicy](qformlayout.html#rowWrapPolicy-prop)。 * * * ## Method Documentation ``` QFormLayout.__init__ (self, QWidget?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個新的窗體布局與給定_parent_小工具。 **See also** [QWidget.setLayout](qwidget.html#setLayout)( ) 。 ``` QFormLayout.addItem (self, QLayoutItem?item) ``` 該_item_說法有它的所有權轉移給Qt的。 從重新實現[QLayout.addItem](qlayout.html#addItem)( ) 。 ``` QFormLayout.addRow (self, QWidget?label, QWidget?field) ``` 該_label_說法有它的所有權轉移給Qt的。 該_field_說法有它的所有權轉移給Qt的。 添加一新行,以這種形式布局的底部,用給定的_label_和_field_。 **See also** [insertRow](qformlayout.html#insertRow)( ) 。 ``` QFormLayout.addRow (self, QWidget?label, QLayout?field) ``` 該_label_說法有它的所有權轉移給Qt的。 該_field_說法有它的所有權轉移給Qt的。 這是一個重載函數。 ``` QFormLayout.addRow (self, QString?labelText, QWidget?field) ``` 該_field_說法有它的所有權轉移給Qt的。 這是一個重載函數。 此重載自動創建一個[QLabel](qlabel.html)背后的幕后_labelText_作為其文本。該_field_被設置為新的[QLabel](qlabel.html)的[buddy](qlabel.html#setBuddy)。 ``` QFormLayout.addRow (self, QString?labelText, QLayout?field) ``` 該_field_說法有它的所有權轉移給Qt的。 這是一個重載函數。 此重載自動創建一個[QLabel](qlabel.html)背后的幕后_labelText_作為其文本。 ``` QFormLayout.addRow (self, QWidget?widget) ``` 該_widget_說法有它的所有權轉移給Qt的。 這是一個重載函數。 將指定的_widget_在這種形式布局的結束。該_widget_橫跨兩列。 ``` QFormLayout.addRow (self, QLayout?layout) ``` 該_layout_說法有它的所有權轉移給Qt的。 這是一個重載函數。 將指定的_layout_在這種形式布局的結束。該_layout_橫跨兩列。 ``` int QFormLayout.count (self) ``` 從重新實現[QLayout.count](qlayout.html#count)( ) 。 ``` Qt.Orientations QFormLayout.expandingDirections (self) ``` [](index.htm) [從重新實現](index.htm)[QLayoutItem.expandingDirections](qlayoutitem.html#expandingDirections)( ) 。 ``` FieldGrowthPolicy QFormLayout.fieldGrowthPolicy (self) ``` [](qformlayout.html#FieldGrowthPolicy-enum) ``` Qt.Alignment QFormLayout.formAlignment (self) ``` [ ``` (int?rowPtr, ItemRole?rolePtr) QFormLayout.getItemPosition (self, int?index) ``` 檢索項的行和角色(列)在指定的_index_。如果_index_是出界, *_rowPtr_被設置為-1 ,否則該行被存儲在*_rowPtr_和作用是存儲在*_rolePtr_。 ](index.htm) [**See also**](index.htm) [itemAt](qformlayout.html#itemAt)( )[count](qformlayout.html#count)( )[getLayoutPosition](qformlayout.html#getLayoutPosition)()和[getWidgetPosition](qformlayout.html#getWidgetPosition)( ) 。 ``` (int?rowPtr, ItemRole?rolePtr) QFormLayout.getLayoutPosition (self, QLayout?layout) ``` 檢索指定的子行和作用(列)_layout_。如果_layout_是不是在形式布局, *_rowPtr_被設置為-1 ,否則該行被存儲在*_rowPtr_和作用是存儲在*_rolePtr_。 ``` (int?rowPtr, ItemRole?rolePtr) QFormLayout.getWidgetPosition (self, QWidget?widget) ``` 檢索指定的行和作用(列)_widget_在布局。如果_widget_是不是在布局, *_rowPtr_被設置為-1 ,否則該行被存儲在*_rowPtr_和作用是存儲在*_rolePtr_。 **See also** [getItemPosition](qformlayout.html#getItemPosition)()和[itemAt](qformlayout.html#itemAt)( ) 。 ``` bool QFormLayout.hasHeightForWidth (self) ``` 從重新實現[QLayoutItem.hasHeightForWidth](qlayoutitem.html#hasHeightForWidth)( ) 。 ``` int QFormLayout.heightForWidth (self, int?width) ``` 從重新實現[QLayoutItem.heightForWidth](qlayoutitem.html#heightForWidth)( ) 。 ``` int QFormLayout.horizontalSpacing (self) ``` ``` QFormLayout.insertRow (self, int?row, QWidget?label, QWidget?field) ``` 該_label_說法有它的所有權轉移給Qt的。 該_field_說法有它的所有權轉移給Qt的。 插入新行的位置_row_在這種形式布局,與給定_label_和_field_。如果_row_是出界,新行是在后面。 **See also** [addRow](qformlayout.html#addRow)( ) 。 ``` QFormLayout.insertRow (self, int?row, QWidget?label, QLayout?field) ``` 該_label_說法有它的所有權轉移給Qt的。 該_field_說法有它的所有權轉移給Qt的。 這是一個重載函數。 ``` QFormLayout.insertRow (self, int?row, QString?labelText, QWidget?field) ``` 該_field_說法有它的所有權轉移給Qt的。 這是一個重載函數。 此重載自動創建一個[QLabel](qlabel.html)背后的幕后_labelText_作為其文本。該_field_被設置為新的[QLabel](qlabel.html)的[buddy](qlabel.html#setBuddy)。 ``` QFormLayout.insertRow (self, int?row, QString?labelText, QLayout?field) ``` 該_field_說法有它的所有權轉移給Qt的。 這是一個重載函數。 此重載自動創建一個[QLabel](qlabel.html)背后的幕后_labelText_作為其文本。 ``` QFormLayout.insertRow (self, int?row, QWidget?widget) ``` 該_widget_說法有它的所有權轉移給Qt的。 這是一個重載函數。 插入指定的_widget_在位置_row_在這種形式布局。該_widget_橫跨兩列。如果_row_是出界,小部件是在后面。 ``` QFormLayout.insertRow (self, int?row, QLayout?layout) ``` 該_layout_說法有它的所有權轉移給Qt的。 這是一個重載函數。 插入指定的_layout_在位置_row_在這種形式布局。該_layout_橫跨兩列。如果_row_是出界,小部件是在后面。 ``` QFormLayout.invalidate (self) ``` 從重新實現[QLayoutItem.invalidate](qlayoutitem.html#invalidate)( ) 。 ``` QLayoutItem QFormLayout.itemAt (self, int?row, ItemRole?role) ``` [ 返回指定布局項目_row_用指定的_role_(列) 。返回0,如果沒有這樣的項目。 ](qlayoutitem.html) [**See also**](qlayoutitem.html) [QLayout.itemAt](qlayout.html#itemAt)()和[setItem](qformlayout.html#setItem)( ) 。 ``` QLayoutItem QFormLayout.itemAt (self, int?index) ``` [](qlayoutitem.html) [從重新實現](qlayoutitem.html)[QLayout.itemAt](qlayout.html#itemAt)( ) 。 ``` Qt.Alignment QFormLayout.labelAlignment (self) ``` [](index.htm) ``` QWidget QFormLayout.labelForField (self, QWidget?field) ``` [ 返回與給定關聯的標籤_field_。 ](qwidget.html) [**See also**](qwidget.html) [itemAt](qformlayout.html#itemAt)( ) 。 ``` QWidget QFormLayout.labelForField (self, QLayout?field) ``` [ 這是一個重載函數。 ](qwidget.html) ``` QSize QFormLayout.minimumSize (self) ``` [](qsize.html) [從重新實現](qsize.html)[QLayoutItem.minimumSize](qlayoutitem.html#minimumSize)( ) 。 ``` int QFormLayout.rowCount (self) ``` 返回行形式的數量。 **See also** [QLayout.count](qlayout.html#count)( ) 。 ``` RowWrapPolicy QFormLayout.rowWrapPolicy (self) ``` [ ``` QFormLayout.setFieldGrowthPolicy (self, FieldGrowthPolicy?policy) ``` ``` QFormLayout.setFormAlignment (self, Qt.Alignment?alignment) ``` ``` QFormLayout.setGeometry (self, QRect?rect) ``` ](qformlayout.html#RowWrapPolicy-enum) [從重新實現](qformlayout.html#RowWrapPolicy-enum)[QLayoutItem.setGeometry](qlayoutitem.html#setGeometry)( ) 。 ``` QFormLayout.setHorizontalSpacing (self, int?spacing) ``` ``` QFormLayout.setItem (self, int?row, ItemRole?role, QLayoutItem?item) ``` 該_item_說法有它的所有權轉移給Qt的。 設置在給定的項目_row_對于給定的_role_至_item_,必要時用空行延伸的布局。 如果電池已經被佔用時,_item_沒有被插入且一個錯誤消息被發送到控制臺。該_item_橫跨兩列。 **Warning:**請不要使用此功能來添加子布局或子部件項目。使用[setLayout](qformlayout.html#setLayout)()或[setWidget](qformlayout.html#setWidget)( )來代替。 **See also** [setLayout](qformlayout.html#setLayout)( ) 。 ``` QFormLayout.setLabelAlignment (self, Qt.Alignment?alignment) ``` ``` QFormLayout.setLayout (self, int?row, ItemRole?role, QLayout?layout) ``` 該_layout_說法有它的所有權轉移給Qt的。 設置子布局在給定的_row_對于給定的_role_至_layout_,必要時用空行延伸的形式布局。 如果電池已經被佔用時,_layout_沒有被插入且一個錯誤消息被發送到控制臺。 **Note:**對于大多數應用,[addRow](qformlayout.html#addRow)()或[insertRow](qformlayout.html#insertRow)( )應該使用的的setLayout ( ) 。 **See also** [setWidget](qformlayout.html#setWidget)( ) 。 ``` QFormLayout.setRowWrapPolicy (self, RowWrapPolicy?policy) ``` ``` QFormLayout.setSpacing (self, int) ``` 此功能可設置垂直和水平間距_spacing_。 **See also** [spacing](qformlayout.html#spacing)( )[setVerticalSpacing](qformlayout.html#verticalSpacing-prop)()和[setHorizontalSpacing](qformlayout.html#horizontalSpacing-prop)( ) 。 ``` QFormLayout.setVerticalSpacing (self, int?spacing) ``` ``` QFormLayout.setWidget (self, int?row, ItemRole?role, QWidget?widget) ``` 該_widget_說法有它的所有權轉移給Qt的。 設置部件在給定的_row_對于給定的_role_至_widget_,必要時用空行延伸的布局。 如果電池已經被佔用時,_widget_沒有被插入且一個錯誤消息被發送到控制臺。 **Note:**對于大多數應用,[addRow](qformlayout.html#addRow)()或[insertRow](qformlayout.html#insertRow)( )應該使用setWidget的( ) 。 **See also** [setLayout](qformlayout.html#setLayout)( ) 。 ``` QSize QFormLayout.sizeHint (self) ``` [](qsize.html) [從重新實現](qsize.html)[QLayoutItem.sizeHint](qlayoutitem.html#sizeHint)( ) 。 ``` int QFormLayout.spacing (self) ``` 如果垂直間距相等的水平間距,這個函數返回該值,否則返回-1 。 **See also** [setSpacing](qformlayout.html#setSpacing)( )[verticalSpacing](qformlayout.html#verticalSpacing-prop)()和[horizontalSpacing](qformlayout.html#horizontalSpacing-prop)( ) 。 ``` QLayoutItem QFormLayout.takeAt (self, int?index) ``` [ 該_QLayoutItem_結果 ](qlayoutitem.html) [從重新實現](qlayoutitem.html)[QLayout.takeAt](qlayout.html#takeAt)( ) 。 ``` int QFormLayout.verticalSpacing (self) ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看