<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # QCompleter Class Reference ## [[QtGui](index.htm) module] 該QCompleter類提供了基于項目模型落成。[More...](#details) 繼承[QObject](qobject.html)。 ### Types * `enum CompletionMode { PopupCompletion, UnfilteredPopupCompletion, InlineCompletion }` * `enum ModelSorting { UnsortedModel, CaseSensitivelySortedModel, CaseInsensitivelySortedModel }` ### Methods * `__init__ (self, QObject?parent?=?None)` * `__init__ (self, QAbstractItemModel?model, QObject?parent?=?None)` * `__init__ (self, QStringList?list, QObject?parent?=?None)` * `Qt.CaseSensitivity caseSensitivity (self)` * `complete (self, QRect?rect?=?QRect())` * `int completionColumn (self)` * `int completionCount (self)` * `CompletionMode completionMode (self)` * `QAbstractItemModel completionModel (self)` * `QString completionPrefix (self)` * `int completionRole (self)` * `QString currentCompletion (self)` * `QModelIndex currentIndex (self)` * `int currentRow (self)` * `bool event (self, QEvent)` * `bool eventFilter (self, QObject?o, QEvent?e)` * `int maxVisibleItems (self)` * `QAbstractItemModel model (self)` * `ModelSorting modelSorting (self)` * `QString pathFromIndex (self, QModelIndex?index)` * `QAbstractItemView popup (self)` * `setCaseSensitivity (self, Qt.CaseSensitivity?caseSensitivity)` * `setCompletionColumn (self, int?column)` * `setCompletionMode (self, CompletionMode?mode)` * `setCompletionPrefix (self, QString?prefix)` * `setCompletionRole (self, int?role)` * `bool setCurrentRow (self, int?row)` * `setMaxVisibleItems (self, int?maxItems)` * `setModel (self, QAbstractItemModel?c)` * `setModelSorting (self, ModelSorting?sorting)` * `setPopup (self, QAbstractItemView?popup)` * `setWidget (self, QWidget?widget)` * `setWrapAround (self, bool?wrap)` * `QStringList splitPath (self, QString?path)` * `QWidget widget (self)` * `bool wrapAround (self)` ### Qt Signals * `void activated (const QString&)` * `void activated (const QModelIndex&)` * `void highlighted (const QString&)` * `void highlighted (const QModelIndex&)` * * * ## Detailed Description 該QCompleter類提供了基于項目模型落成。 您可以使用QCompleter提供自動完成功能在任何Qt的窗口小部件,如[QLineEdit](qlineedit.html)和[QComboBox](qcombobox.html)。當用戶開始輸入一個字, QCompleter提示完成單詞根據單詞列表的可能途徑。單詞列表是作為一個[QAbstractItemModel](qabstractitemmodel.html)。 (對于簡單的應用,這里所說的列表是靜態的,你可以通過一個[QStringList](qstringlist.html)到QCompleter的構造函數。 ) ### Basic Usage 一個QCompleter通常用于與[QLineEdit](qlineedit.html) or [QComboBox](qcombobox.html)。例如,這里是如何從一個簡單的單詞列表提供自動補全[QLineEdit](qlineedit.html): ``` [QStringList](qstringlist.html) wordList; wordList << "alpha" << "omega" << "omicron" << "zeta"; [QLineEdit](qlineedit.html) *lineEdit = new [QLineEdit](qlineedit.html)(this); QCompleter *completer = new QCompleter(wordList, this); completer->setCaseSensitivity([Qt](qt.html).CaseInsensitive); lineEdit->setCompleter(completer); ``` A [QFileSystemModel](qfilesystemmodel.html)可用于提供文件名的自動完成。例如: ``` QCompleter *completer = new QCompleter(this); completer->setModel(new [QDirModel](qdirmodel.html)(completer)); lineEdit->setCompleter(completer); ``` 要設置哪些QCompleter應操作模式,通話時間[setModel](qcompleter.html#setModel)( ) 。默認情況下, QCompleter將嘗試匹配[completion prefix](qcompleter.html#completionPrefix-prop)(也就是說,用戶已經開始鍵入單詞)對[Qt.EditRole](qt.html#ItemDataRole-enum)存儲在模型的情況下0列數據敏感。這可以使用被改變[setCompletionRole](qcompleter.html#completionRole-prop)( )[setCompletionColumn](qcompleter.html#completionColumn-prop)()和[setCaseSensitivity](qcompleter.html#caseSensitivity-prop)( ) 。 如果模型進行排序了用于完成列和作用,可以調用[setModelSorting](qcompleter.html#modelSorting-prop)( )與任何[QCompleter.CaseSensitivelySortedModel](qcompleter.html#ModelSorting-enum) or [QCompleter.CaseInsensitivelySortedModel](qcompleter.html#ModelSorting-enum)作為參數。在大型模型,這可能會導致顯著的性能提升,因為QCompleter就可以使用二進制搜索,而不是線性搜索。 該模型可以是一[list model](qabstractlistmodel.html),一[table model](qabstracttablemodel.html)或[tree model](qabstractitemmodel.html)。完成對樹模型是稍微更復雜,并復蓋在[Handling Tree Models](#handling-tree-models)下面一節。 該[completionMode](qcompleter.html#completionMode-prop)()確定用于提供完井給用戶的方式。 ### Iterating Through Completions 檢索單個候選字符串,調用[setCompletionPrefix](qcompleter.html#completionPrefix-prop)()與需要完成的文本和通話[currentCompletion](qcompleter.html#currentCompletion)( ) 。您可以通過補全列表迭代如下: ``` for (int i = 0; completer->setCurrentRow(i); i++) qDebug() << completer->currentCompletion() << " is match number " << i; ``` [completionCount](qcompleter.html#completionCount)()返回完井的總數為當前前綴。[completionCount](qcompleter.html#completionCount)()時,應避免可能的,因為它要求在整個模型的掃描。 ### The Completion Model [completionModel](qcompleter.html#completionModel)( )返回一個包含所有可能的補全當前完成前綴列表模式,在它們出現在模型中的順序。該模型可用于顯示當前的落成在自定義視圖。調用[setCompletionPrefix](qcompleter.html#completionPrefix-prop)( )自動刷新完成模型。 ### Handling Tree Models QCompleter可以尋找在樹模型的完成,假設任何項目(或子項或子分項)可以明確指定該項目的路徑表示為一個字符串。完成,然后進行一個級別的時間。 讓我們在一個文件系統中的路徑的用戶輸入的示例。該模型是一個(分層)[QFileSystemModel](qfilesystemmodel.html)。完成出現在路徑中的每個元素。例如,如果當前的文本是`C:\Wind`, QCompleter可能會建議`Windows`完成當前路徑元素。同樣,如果當前的文本是`C:\Windows\Sy`, QCompleter可能會建議`System`。 對于這種完成工作的, QCompleter需要能夠將路徑分割成匹配在每個級別的字符串列表。為`C:\Windows\Sy`,它需要被分割為“C :”,“窗口”和“施” 。的默認實現[splitPath](qcompleter.html#splitPath)( ) ,分裂[completionPrefix](qcompleter.html#completionPrefix-prop) using [QDir.separator](qdir.html#separator)( )如果模型是一個[QFileSystemModel](qfilesystemmodel.html)。 提供完井, QCompleter需要從索引知道路徑。這是通過提供[pathFromIndex](qcompleter.html#pathFromIndex)( ) 。的默認實現[pathFromIndex](qcompleter.html#pathFromIndex)( ) ,返回的數據[edit role](qt.html#ItemDataRole-enum)為列表模式和絕對文件路徑,如果模式是[QFileSystemModel](qfilesystemmodel.html)。 * * * ## Type Documentation ``` QCompleter.CompletionMode ``` 該枚舉指定如何完井提供給用戶。 | Constant | Value | Description | | --- | --- | --- | | `QCompleter.PopupCompletion` | `0` | 目前完井顯示在一個彈出窗口。 | | `QCompleter.InlineCompletion` | `2` | 完井行內顯示(選定文本)。 | | `QCompleter.UnfilteredPopupCompletion` | `1` | 所有可能的完成與指示為當前最有可能的建議,顯示在一個彈出窗口中。 | **See also** [setCompletionMode](qcompleter.html#completionMode-prop)( ) 。 ``` QCompleter.ModelSorting ``` 此枚舉指定如何在模型中的項目進行排序。 | Constant | Value | Description | | --- | --- | --- | | `QCompleter.UnsortedModel` | `0` | 該模型是未排序。 | | `QCompleter.CaseSensitivelySortedModel` | `1` | 該模型是敏感排序的情況。 | | `QCompleter.CaseInsensitivelySortedModel` | `2` | 該模型是不區分大小寫排序的情況。 | **See also** [setModelSorting](qcompleter.html#modelSorting-prop)( ) 。 * * * ## Method Documentation ``` QCompleter.__init__ (self, QObject?parent?=?None) ``` 該_parent_爭論 構造一個完成者對象與給定_parent_。 ``` QCompleter.__init__ (self, QAbstractItemModel?model, QObject?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個完成者對象與給定_parent_提供完井從指定的_model_。 ``` QCompleter.__init__ (self, QStringList?list, QObject?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個[QCompleter](qcompleter.html)與給定對象_parent_使用指定的_list_作為盡可能完整的源代碼。 ``` Qt.CaseSensitivity QCompleter.caseSensitivity (self) ``` [ ``` QCompleter.complete (self, QRect?rect?=?QRect()) ``` 這種方法也是一個Qt槽與C + +的簽名`void complete(const QRect& = QRect())`。 ](qt.html#CaseSensitivity-enum) [為](qt.html#CaseSensitivity-enum)[QCompleter.PopupCompletion](qcompleter.html#CompletionMode-enum)和QCompletion.UnfilteredPopupCompletion模式,調用這個函數顯示顯示當前落成彈出。默認情況下,如果_rect_沒有指定,則彈出窗口顯示的底部[widget](qcompleter.html#widget)( ) 。如果_rect_指定了彈出窗口被顯示在矩形的左邊緣。 為[QCompleter.InlineCompletion](qcompleter.html#CompletionMode-enum)模式下,[highlighted](qcompleter.html#highlighted)( )信號被發射了與當前的完成。 ``` int QCompleter.completionColumn (self) ``` ``` int QCompleter.completionCount (self) ``` 返回完井的數量為當前前綴。對于有大量項目的未排序的模型可以是昂貴的。使用[setCurrentRow](qcompleter.html#setCurrentRow)()和[currentCompletion](qcompleter.html#currentCompletion)( )遍歷所有的補全。 ``` CompletionMode QCompleter.completionMode (self) ``` [](qcompleter.html#CompletionMode-enum) ``` QAbstractItemModel QCompleter.completionModel (self) ``` [ 返回完成模型。在完成模型是包含所有當前完成前綴可能的匹配一個只讀列表模式。完成模型自動更新,以反映當前的落成。 ](qabstractitemmodel.html) [**Note:**這個函數的返回值被定義為一個](qabstractitemmodel.html)[QAbstractItemModel](qabstractitemmodel.html)純粹是為了通用性。這實際返回的一種模型是一個實例[QAbstractProxyModel](qabstractproxymodel.html)子類。 **See also** [completionPrefix](qcompleter.html#completionPrefix-prop)和[model](qcompleter.html#model)( ) 。 ``` QString QCompleter.completionPrefix (self) ``` ``` int QCompleter.completionRole (self) ``` ``` QString QCompleter.currentCompletion (self) ``` 返回當前完井管柱。這包括[completionPrefix](qcompleter.html#completionPrefix-prop)。當一起使用[setCurrentRow](qcompleter.html#setCurrentRow)( ) ,它可以用來遍歷所有的比賽。 **See also** [setCurrentRow](qcompleter.html#setCurrentRow)()和[currentIndex](qcompleter.html#currentIndex)( ) 。 ``` QModelIndex QCompleter.currentIndex (self) ``` [](qmodelindex.html) [返回在當前完成的模型索引](qmodelindex.html)[completionModel](qcompleter.html#completionModel)( ) 。 **See also** [setCurrentRow](qcompleter.html#setCurrentRow)( )[currentCompletion](qcompleter.html#currentCompletion)()和[model](qcompleter.html#model)( ) 。 ``` int QCompleter.currentRow (self) ``` 返回當前行。 **See also** [setCurrentRow](qcompleter.html#setCurrentRow)( ) 。 ``` bool QCompleter.event (self, QEvent) ``` 從重新實現[QObject.event](qobject.html#event)( ) 。 ``` bool QCompleter.eventFilter (self, QObject?o, QEvent?e) ``` 從重新實現[QObject.eventFilter](qobject.html#eventFilter)( ) 。 ``` int QCompleter.maxVisibleItems (self) ``` ``` QAbstractItemModel QCompleter.model (self) ``` [ 返回提供完井管柱模型。 ](qabstractitemmodel.html) [**See also**](qabstractitemmodel.html) [setModel](qcompleter.html#setModel)()和[completionModel](qcompleter.html#completionModel)( ) 。 ``` ModelSorting QCompleter.modelSorting (self) ``` [ ``` QString QCompleter.pathFromIndex (self, QModelIndex?index) ``` 返回路徑為給定的_index_。完成者對象使用這個從底層模型得到完成文本。 ](qcompleter.html#ModelSorting-enum) [默認實現返回](qcompleter.html#ModelSorting-enum)[edit role](qt.html#ItemDataRole-enum)為列表模式的項目。它返回文件的絕對路徑,如果這個模型是一個[QFileSystemModel](qfilesystemmodel.html)。 **See also** [splitPath](qcompleter.html#splitPath)( ) 。 ``` QAbstractItemView QCompleter.popup (self) ``` [ 返回用于顯示落成彈出。 ](qabstractitemview.html) [**See also**](qabstractitemview.html) [setPopup](qcompleter.html#setPopup)( ) 。 ``` QCompleter.setCaseSensitivity (self, Qt.CaseSensitivity?caseSensitivity) ``` ``` QCompleter.setCompletionColumn (self, int?column) ``` ``` QCompleter.setCompletionMode (self, CompletionMode?mode) ``` ``` QCompleter.setCompletionPrefix (self, QString?prefix) ``` 這種方法也是一個Qt槽與C + +的簽名`void setCompletionPrefix(const QString&)`。 ``` QCompleter.setCompletionRole (self, int?role) ``` ``` bool QCompleter.setCurrentRow (self, int?row) ``` 當前行設置為_row_規定。成功返回True ,否則返回False 。 這個功能可以隨著所用[currentCompletion](qcompleter.html#currentCompletion)( )遍歷所有可能的補全。 **See also** [currentRow](qcompleter.html#currentRow)( )[currentCompletion](qcompleter.html#currentCompletion)()和[completionCount](qcompleter.html#completionCount)( ) 。 ``` QCompleter.setMaxVisibleItems (self, int?maxItems) ``` ``` QCompleter.setModel (self, QAbstractItemModel?c) ``` 設置提供完井模型_model_。該_model_可以列表模式或樹模型。如果模型已經被預先設置,并具有[QCompleter](qcompleter.html)作為其母公司,將被刪除。 為方便起見,如果_model_是[QFileSystemModel](qfilesystemmodel.html),[QCompleter](qcompleter.html)其切換[caseSensitivity](qcompleter.html#caseSensitivity-prop)至[Qt.CaseInsensitive](qt.html#CaseSensitivity-enum)在Windows和[Qt.CaseSensitive](qt.html#CaseSensitivity-enum)在其他平臺上。 **See also** [completionModel](qcompleter.html#completionModel)( )[modelSorting](qcompleter.html#modelSorting-prop)和[Handling Tree Models](qcompleter.html#handling-tree-models)。 ``` QCompleter.setModelSorting (self, ModelSorting?sorting) ``` ``` QCompleter.setPopup (self, QAbstractItemView?popup) ``` 該_popup_說法有它的所有權轉移給Qt的。 設置用于顯示完井彈出_popup_。[QCompleter](qcompleter.html)采用該視圖的所有權。 A [QListView](qlistview.html)時自動創建的[completionMode](qcompleter.html#completionMode-prop)( )被設置為[QCompleter.PopupCompletion](qcompleter.html#CompletionMode-enum) or [QCompleter.UnfilteredPopupCompletion](qcompleter.html#CompletionMode-enum)。默認的彈出窗口顯示[completionColumn](qcompleter.html#completionColumn-prop)( ) 。 確保這個函數被調用視圖設置被修改之前。這是必需的,因為視圖的屬性可能需要一個模型已經被設置的視圖(例如,隱藏在視圖中的列需要一個模型要在視圖中設置) 。 **See also** [popup](qcompleter.html#popup)( ) 。 ``` QCompleter.setWidget (self, QWidget?widget) ``` 該_widget_說法有它的所有權轉移給Qt的。 設置用來完成所規定的小部件_widget_。這個函數被自動調用,當[QCompleter](qcompleter.html)設置在[QLineEdit](qlineedit.html) using [QLineEdit.setCompleter](qlineedit.html#setCompleter)()或上一個[QComboBox](qcombobox.html) using [QComboBox.setCompleter](qcombobox.html#setCompleter)( ) 。該部件需要明確規定完成為自定義控件時進行設置。 **See also** [widget](qcompleter.html#widget)( )[setModel](qcompleter.html#setModel)()和[setPopup](qcompleter.html#setPopup)( ) 。 ``` QCompleter.setWrapAround (self, bool?wrap) ``` 這種方法也是一個Qt槽與C + +的簽名`void setWrapAround(bool)`。 ``` QStringList QCompleter.splitPath (self, QString?path) ``` 拆分給定的_path_成用于匹配在每個級別的字符串[model](qcompleter.html#model)( ) 。 splitPath的默認實現( )分割基于文件系統路徑[QDir.separator](qdir.html#separator)()當sourceModel ()是一個[QFileSystemModel](qfilesystemmodel.html)。 當與表模型中使用,在返回列表中的第一個項目是用于匹配。 **See also** [pathFromIndex](qcompleter.html#pathFromIndex)()和[Handling Tree Models](qcompleter.html#handling-tree-models)。 ``` QWidget QCompleter.widget (self) ``` [ 返回其完成者對象提供的補全部件。 ](qwidget.html) [**See also**](qwidget.html) [setWidget](qcompleter.html#setWidget)( ) 。 ``` bool QCompleter.wrapAround (self) ``` * * * ## Qt Signal Documentation ``` void activated (const QString&) ``` 這是該信號的默認超載。 這個信號被發送時,在一個項目[popup](qcompleter.html#popup)( )是由用戶(通過單擊或按回車鍵)激活。該項目的_text_給出。 ``` void activated (const QModelIndex&) ``` 這個信號被發送時,在一個項目[popup](qcompleter.html#popup)()是由用戶激活。 (通過單擊或按回車鍵) 。該項目的_index_在[completionModel](qcompleter.html#completionModel)()給出。 ``` void highlighted (const QString&) ``` 這是該信號的默認超載。 這個信號被發送時,在一個項目[popup](qcompleter.html#popup)()是由用戶突出顯示。它也被發送,如果[complete](qcompleter.html#complete)( )被調用,[completionMode](qcompleter.html#completionMode-prop)()設定為[QCompleter.InlineCompletion](qcompleter.html#CompletionMode-enum)。該項目的_text_給出。 ``` void highlighted (const QModelIndex&) ``` 這個信號被發送時,在一個項目[popup](qcompleter.html#popup)()是由用戶突出顯示。它也被發送,如果[complete](qcompleter.html#complete)( )被調用,[completionMode](qcompleter.html#completionMode-prop)()設定為[QCompleter.InlineCompletion](qcompleter.html#CompletionMode-enum)。該項目的_index_在[completionModel](qcompleter.html#completionModel)()給出。
                  <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>

                              哎呀哎呀视频在线观看