<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之旅 廣告
                # QFileSystemModel Class Reference ## [[QtGui](index.htm) module] 該QFileSystemModel類提供了在本地文件系統的數據模型。[More...](#details) 繼承[QAbstractItemModel](qabstractitemmodel.html)。 ### Types * `enum Roles { FileIconRole, FilePathRole, FileNameRole, FilePermissions }` ### Methods * `__init__ (self, QObject?parent?=?None)` * `bool canFetchMore (self, QModelIndex?parent)` * `int columnCount (self, QModelIndex?parent?=?QModelIndex())` * `QVariant data (self, QModelIndex?index, int?role?=?Qt.DisplayRole)` * `bool dropMimeData (self, QMimeData?data, Qt.DropAction?action, int?row, int?column, QModelIndex?parent)` * `bool event (self, QEvent?event)` * `fetchMore (self, QModelIndex?parent)` * `QIcon fileIcon (self, QModelIndex?aindex)` * `QFileInfo fileInfo (self, QModelIndex?aindex)` * `QString fileName (self, QModelIndex?aindex)` * `QString filePath (self, QModelIndex?index)` * `QDir.Filters filter (self)` * `Qt.ItemFlags flags (self, QModelIndex?index)` * `bool hasChildren (self, QModelIndex?parent?=?QModelIndex())` * `QVariant headerData (self, int?section, Qt.Orientation?orientation, int?role?=?Qt.DisplayRole)` * `QFileIconProvider iconProvider (self)` * `QModelIndex index (self, int?row, int?column, QModelIndex?parent?=?QModelIndex())` * `QModelIndex index (self, QString?path, int?column?=?0)` * `bool isDir (self, QModelIndex?index)` * `bool isReadOnly (self)` * `QDateTime lastModified (self, QModelIndex?index)` * `QMimeData mimeData (self, list-of-QModelIndex?indexes)` * `QStringList mimeTypes (self)` * `QModelIndex mkdir (self, QModelIndex?parent, QString?name)` * `QVariant myComputer (self, int?role?=?Qt.DisplayRole)` * `bool nameFilterDisables (self)` * `QStringList nameFilters (self)` * `QModelIndex parent (self, QModelIndex?child)` * `QFile.Permissions permissions (self, QModelIndex?index)` * `bool remove (self, QModelIndex?aindex)` * `bool resolveSymlinks (self)` * `bool rmdir (self, QModelIndex?aindex)` * `QDir rootDirectory (self)` * `QString rootPath (self)` * `int rowCount (self, QModelIndex?parent?=?QModelIndex())` * `bool setData (self, QModelIndex?idx, QVariant?value, int?role?=?Qt.EditRole)` * `setFilter (self, QDir.Filters?filters)` * `setIconProvider (self, QFileIconProvider?provider)` * `setNameFilterDisables (self, bool?enable)` * `setNameFilters (self, QStringList?filters)` * `setReadOnly (self, bool?enable)` * `setResolveSymlinks (self, bool?enable)` * `QModelIndex setRootPath (self, QString?path)` * `int size (self, QModelIndex?index)` * `sort (self, int?column, Qt.SortOrder?order?=?Qt.AscendingOrder)` * `Qt.DropActions supportedDropActions (self)` * `timerEvent (self, QTimerEvent?event)` * `QString type (self, QModelIndex?index)` ### Qt Signals * `void directoryLoaded (const QString&)` * `void fileRenamed (const QString&,const QString&,const QString&)` * `void rootPathChanged (const QString&)` * * * ## Detailed Description 該QFileSystemModel類提供了在本地文件系統的數據模型。 這個類提供了訪問本地文件系統,提供了功能重命名和刪除文件和目錄,并創建新的目錄。在最簡單的情況下,它可以用于與合適的顯示部件作為一個瀏覽器或過濾器的一部分。 QFileSystemModel可以使用所提供的標準接口來訪問[QAbstractItemModel](qabstractitemmodel.html)的,但它也提供了一些方便的功能所特有的一個目錄模型。該[fileInfo](qfilesystemmodel.html#fileInfo)( )[isDir](qfilesystemmodel.html#isDir)( )[name](index.htm#name)( )和路徑( )函數提供了有關與模型中的項目相關的文件和目錄信息。目錄中可以創建和刪除使用[mkdir](qfilesystemmodel.html#mkdir)( )[rmdir](qfilesystemmodel.html#rmdir)( ) 。 **Note:**QFileSystemModel需要一個GUI應用程序的一個實例。 ### Example Usage 通常是構造一個父對象,顯示一個默認目錄中的內容的目錄型號: ``` QFileSystemModel *model = new QFileSystemModel; model->setRootPath([QDir](qdir.html).currentPath()); ``` 樹視圖可用于顯示模型的內容 ``` [QTreeView](qtreeview.html) *tree = new [QTreeView](qtreeview.html)(splitter); tree->setModel(model); ``` 和一個特定的目錄中的內容可以顯示通過將樹視圖的根指數: ``` tree->setRootIndex(model->index([QDir](qdir.html).currentPath())); ``` 視圖的根指數,可用于控制如何分層模型的多顯示。[QDirModel(obsolete)](qdirmodel.html)提供了一個方便的功能,用于返回一個路徑模型中的一個目錄一個合適的模型索引。 ### Caching and Performance QFileSystemModel不會獲取任何文件或目錄,直到[setRootPath](qfilesystemmodel.html#setRootPath)()被調用。這將防止在文件系統上的任何不必要的查詢,直到這一點,如清單上的Windows的驅動器。 不像[QDirModel(obsolete)](qdirmodel.html), QFileSystemModel使用單獨的線程來填充自身,所以它不會造成主線程掛起的文件系統受到質疑。調用[rowCount](qfilesystemmodel.html#rowCount)( )將返回0 ,直到模型填充的目錄。 QFileSystemModel保持與文件信息的高速緩存。高速緩存是使用自動保持更新的[QFileSystemWatcher](qfilesystemwatcher.html)。 * * * ## Type Documentation ``` QFileSystemModel.Roles ``` | Constant | Value | | --- | --- | | `QFileSystemModel.FileIconRole` | `Qt.DecorationRole` | | `QFileSystemModel.FilePathRole` | `Qt.UserRole + 1` | | `QFileSystemModel.FileNameRole` | `Qt.UserRole + 2` | | `QFileSystemModel.FilePermissions` | `Qt.UserRole + 3` | * * * ## Method Documentation ``` QFileSystemModel.__init__ (self, QObject?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個文件系統模型與給定的_parent_。 ``` bool QFileSystemModel.canFetchMore (self, QModelIndex?parent) ``` 從重新實現[QAbstractItemModel.canFetchMore](qabstractitemmodel.html#canFetchMore)( ) 。 ``` int QFileSystemModel.columnCount (self, QModelIndex?parent?=?QModelIndex()) ``` 從重新實現[QAbstractItemModel.columnCount](qabstractitemmodel.html#columnCount)( ) 。 ``` QVariant QFileSystemModel.data (self, QModelIndex?index, int?role?=?Qt.DisplayRole) ``` 從重新實現[QAbstractItemModel.data](qabstractitemmodel.html#data)( ) 。 **See also** [setData](qfilesystemmodel.html#setData)( ) 。 ``` bool QFileSystemModel.dropMimeData (self, QMimeData?data, Qt.DropAction?action, int?row, int?column, QModelIndex?parent) ``` 從重新實現[QAbstractItemModel.dropMimeData](qabstractitemmodel.html#dropMimeData)( ) 。 處理_data_通過拖放操作,與給定的供給結束_action_過在由指定的模型中的行_row_和_column_以及由_parent_索引。 **See also** [supportedDropActions](qfilesystemmodel.html#supportedDropActions)( ) 。 ``` bool QFileSystemModel.event (self, QEvent?event) ``` 從重新實現[QObject.event](qobject.html#event)( ) 。 ``` QFileSystemModel.fetchMore (self, QModelIndex?parent) ``` 從重新實現[QAbstractItemModel.fetchMore](qabstractitemmodel.html#fetchMore)( ) 。 ``` QIcon QFileSystemModel.fileIcon (self, QModelIndex?aindex) ``` [ 根據給定的返回存儲在模型中的項的圖標_index_。 ](qicon.html) ``` QFileInfo QFileSystemModel.fileInfo (self, QModelIndex?aindex) ``` [](qfileinfo.html) [返回](qfileinfo.html)[QFileInfo](qfileinfo.html)根據給定的存儲在模型中的項_index_。 ``` QString QFileSystemModel.fileName (self, QModelIndex?aindex) ``` 返回根據給定的存儲在模型中的項目的文件名_index_。 ``` QString QFileSystemModel.filePath (self, QModelIndex?index) ``` 返回根據存儲在模型中的項的路徑_index_給出。 ``` QDir.Filters QFileSystemModel.filter (self) ``` [ 返回目錄模型中指定的過濾器。 ](index.htm) [如果一個過濾器沒有被設置,則默認過濾器是](index.htm)[QDir.AllEntries](qdir.html#Filter-enum)|[QDir.NoDotAndDotDot](qdir.html#Filter-enum)|[QDir.AllDirs](qdir.html#Filter-enum)。 **See also** [setFilter](qfilesystemmodel.html#setFilter)()和[QDir.Filters](qdir.html#Filter-enum)。 ``` Qt.ItemFlags QFileSystemModel.flags (self, QModelIndex?index) ``` [](index.htm) [從重新實現](index.htm)[QAbstractItemModel.flags](qabstractitemmodel.html#flags)( ) 。 ``` bool QFileSystemModel.hasChildren (self, QModelIndex?parent?=?QModelIndex()) ``` 從重新實現[QAbstractItemModel.hasChildren](qabstractitemmodel.html#hasChildren)( ) 。 ``` QVariant QFileSystemModel.headerData (self, int?section, Qt.Orientation?orientation, int?role?=?Qt.DisplayRole) ``` 從重新實現[QAbstractItemModel.headerData](qabstractitemmodel.html#headerData)( ) 。 ``` QFileIconProvider QFileSystemModel.iconProvider (self) ``` [ 返回文件的圖標提供商此目錄的模式。 ](qfileiconprovider.html) [**See also**](qfileiconprovider.html) [setIconProvider](qfilesystemmodel.html#setIconProvider)( ) 。 ``` QModelIndex QFileSystemModel.index (self, int?row, int?column, QModelIndex?parent?=?QModelIndex()) ``` [](qmodelindex.html) [從重新實現](qmodelindex.html)[QAbstractItemModel.index](qabstractitemmodel.html#index)( ) 。 ``` QModelIndex QFileSystemModel.index (self, QString?path, int?column?=?0) ``` [ 這是一個重載函數。 返回模型項指數為給定的_path_和_column_。 ``` bool QFileSystemModel.isDir (self, QModelIndex?index) ``` 返回True如果模型項目_index_表示一個目錄,否則返回False 。 ``` bool QFileSystemModel.isReadOnly (self) ``` ](qmodelindex.html) ``` QDateTime QFileSystemModel.lastModified (self, QModelIndex?index) ``` [ 返回的日期和時間時_index_最后修訂。 ](qdatetime.html) ``` QMimeData QFileSystemModel.mimeData (self, list-of-QModelIndex?indexes) ``` [](qmimedata.html) [從重新實現](qmimedata.html)[QAbstractItemModel.mimeData](qabstractitemmodel.html#mimeData)( ) 。 返回一個對象,該對象包含指定的序列化描述_indexes_。用于描述對應于該索引的項的格式是從所獲得的[mimeTypes](qfilesystemmodel.html#mimeTypes)()函數。 如果索引的列表為空,則返回0 ,而不是一個序列化的空單。 ``` QStringList QFileSystemModel.mimeTypes (self) ``` 從重新實現[QAbstractItemModel.mimeTypes](qabstractitemmodel.html#mimeTypes)( ) 。 返回可用于描述在模型中的項列表的MIME類型的列表。 ``` QModelIndex QFileSystemModel.mkdir (self, QModelIndex?parent, QString?name) ``` [ 創建具有一個目錄_name_在_parent_模型索引。 ``` QVariant QFileSystemModel.myComputer (self, int?role?=?Qt.DisplayRole) ``` 返回下指定存儲的數據_role_該項目“我的電腦” 。 ](qmodelindex.html) [**See also**](qmodelindex.html) [Qt.ItemDataRole](qt.html#ItemDataRole-enum)。 ``` bool QFileSystemModel.nameFilterDisables (self) ``` ``` QStringList QFileSystemModel.nameFilters (self) ``` 返回應用到該模型中的名稱的過濾器列表。 **See also** [setNameFilters](qfilesystemmodel.html#setNameFilters)( ) 。 ``` QModelIndex QFileSystemModel.parent (self, QModelIndex?child) ``` [](qmodelindex.html) [從重新實現](qmodelindex.html)[QAbstractItemModel.parent](qabstractitemmodel.html#parent)( ) 。 ``` QFile.Permissions QFileSystemModel.permissions (self, QModelIndex?index) ``` [](index.htm) [返回的完整或的結果組合在一起](index.htm)[QFile.Permission](qfile.html#Permission-enum)為_index_。 ``` bool QFileSystemModel.remove (self, QModelIndex?aindex) ``` 刪除模型項目_index_從文件系統模型和**deletes the corresponding file from the file system**,返回True,如果成功的。如果該項目不能被刪除,則返回False。 **Warning:**此函數刪除從文件系統中的文件,它**not**它們移動到那里他們可以恢復的位置。 **See also** [rmdir](qfilesystemmodel.html#rmdir)( ) 。 ``` bool QFileSystemModel.resolveSymlinks (self) ``` ``` bool QFileSystemModel.rmdir (self, QModelIndex?aindex) ``` 刪除對應的模型項目的目錄_index_在文件系統模型和**deletes the corresponding directory from the file system**,返回True,如果成功的。如果目錄不能被刪除,則返回False。 **Warning:**此函數刪除目錄的文件系統;它**not**它們移動到那里他們可以恢復的位置。 **See also** [remove](qfilesystemmodel.html#remove)( ) 。 ``` QDir QFileSystemModel.rootDirectory (self) ``` [ 當前設置的目錄 ](qdir.html) [**See also**](qdir.html) [rootPath](qfilesystemmodel.html#rootPath)( ) 。 ``` QString QFileSystemModel.rootPath (self) ``` 當前設置的根路徑 **See also** [setRootPath](qfilesystemmodel.html#setRootPath)()和[rootDirectory](qfilesystemmodel.html#rootDirectory)( ) 。 ``` int QFileSystemModel.rowCount (self, QModelIndex?parent?=?QModelIndex()) ``` 從重新實現[QAbstractItemModel.rowCount](qabstractitemmodel.html#rowCount)( ) 。 ``` bool QFileSystemModel.setData (self, QModelIndex?idx, QVariant?value, int?role?=?Qt.EditRole) ``` 從重新實現[QAbstractItemModel.setData](qabstractitemmodel.html#setData)( ) 。 **See also** [data](qfilesystemmodel.html#data)( ) 。 ``` QFileSystemModel.setFilter (self, QDir.Filters?filters) ``` 設置目錄型號的過濾器,通過指定_filters_。 請注意,您設置的過濾器應始終包含[QDir.AllDirs](qdir.html#Filter-enum)枚舉值,否則[QFileSystemModel](qfilesystemmodel.html)將無法讀取的目錄結構。 **See also** [filter](qfilesystemmodel.html#filter)()和[QDir.Filters](qdir.html#Filter-enum)。 ``` QFileSystemModel.setIconProvider (self, QFileIconProvider?provider) ``` 設置_provider_文件圖標的目錄模式。 **See also** [iconProvider](qfilesystemmodel.html#iconProvider)( ) 。 ``` QFileSystemModel.setNameFilterDisables (self, bool?enable) ``` ``` QFileSystemModel.setNameFilters (self, QStringList?filters) ``` 設置名稱_filters_應用對現有的文件。 **See also** [nameFilters](qfilesystemmodel.html#nameFilters)( ) 。 ``` QFileSystemModel.setReadOnly (self, bool?enable) ``` ``` QFileSystemModel.setResolveSymlinks (self, bool?enable) ``` ``` QModelIndex QFileSystemModel.setRootPath (self, QString?path) ``` [](qmodelindex.html) [設置被觀看了該模型的目錄_newPath_通過安裝](qmodelindex.html)[file system watcher](qfilesystemwatcher.html)就可以了。任何更改的文件和該目錄下的目錄將反映在模型中。 如果該路徑被改變,[rootPathChanged](qfilesystemmodel.html#rootPathChanged)()信號將被發射。 **Note:**此函數不改變模型的結構或修改提供給視圖的數據。換句話說,本模型的“根”是_not_更改為包含所指定的目錄中唯一的文件和目錄_newPath_在文件系統中。 **See also** [rootPath](qfilesystemmodel.html#rootPath)( ) 。 ``` int QFileSystemModel.size (self, QModelIndex?index) ``` 返回該尺寸中的字節_index_。如果文件不存在,則返回0 。 ``` QFileSystemModel.sort (self, int?column, Qt.SortOrder?order?=?Qt.AscendingOrder) ``` 從重新實現[QAbstractItemModel.sort](qabstractitemmodel.html#sort)( ) 。 ``` Qt.DropActions QFileSystemModel.supportedDropActions (self) ``` [](index.htm) [從重新實現](index.htm)[QAbstractItemModel.supportedDropActions](qabstractitemmodel.html#supportedDropActions)( ) 。 ``` QFileSystemModel.timerEvent (self, QTimerEvent?event) ``` 從重新實現[QObject.timerEvent](qobject.html#timerEvent)( ) 。 ``` QString QFileSystemModel.type (self, QModelIndex?index) ``` 返回文件的類型_index_如“目錄”或“ JPEG文件” 。 * * * ## Qt Signal Documentation ``` void directoryLoaded (const QString&) ``` 這是該信號的默認超載。 當采集線程完成加載這個信號被發射的_path_。 此功能被引入Qt的4.7 。 ``` void fileRenamed (const QString&,const QString&,const QString&) ``` 這是該信號的默認超載。 這個信號被發射時與一個文件_oldName_成功更名為_newName_。該文件位于目錄_path_。 ``` void rootPathChanged (const QString&) ``` 這是該信號的默認超載。 這個信號被發射時的根路徑已被更改為一個_newPath_。
                  <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>

                              哎呀哎呀视频在线观看