qfilesystemmodel.html 52.3 KB
Newer Older
xuebingbing's avatar
xuebingbing committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qfilesystemmodel.cpp -->
  <title>QFileSystemModel Class | Qt Widgets 5.11</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.11</a></td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QFileSystemModel</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.11.2 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#reimplemented-public-functions">Reimplemented Public Functions</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#reimplemented-protected-functions">Reimplemented Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#example-usage">Example Usage</a></li>
<li class="level2"><a href="#caching-and-performance">Caching and Performance</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QFileSystemModel Class</h1>
<!-- $$$QFileSystemModel-brief -->
<p>The <a href="qfilesystemmodel.html">QFileSystemModel</a> class provides a data model for the local filesystem. <a href="#details">More...</a></p>
<!-- @@@QFileSystemModel -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QFileSystemModel&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += widgets</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign">  Qt 4.4</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a></td></tr></table></div><ul>
<li><a href="qfilesystemmodel-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#Roles-enum">Roles</a></b> { FileIconRole, FilePathRole, FileNameRole, FilePermissions }</td></tr>
</table></div>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><a href="qfilesystemmodel.html#nameFilterDisables-prop">nameFilterDisables</a></b> : bool</li>
<li class="fn"><b><a href="qfilesystemmodel.html#readOnly-prop">readOnly</a></b> : bool</li>
<li class="fn"><b><a href="qfilesystemmodel.html#resolveSymlinks-prop">resolveSymlinks</a></b> : bool</li>
</ul>
<ul>
<li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#QFileSystemModel">QFileSystemModel</a></b>(QObject *<i>parent</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#dtor.QFileSystemModel">~QFileSystemModel</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QIcon </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#fileIcon">fileIcon</a></b>(const QModelIndex &amp;<i>index</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QFileInfo </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#fileInfo">fileInfo</a></b>(const QModelIndex &amp;<i>index</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#fileName">fileName</a></b>(const QModelIndex &amp;<i>index</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#filePath">filePath</a></b>(const QModelIndex &amp;<i>index</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDir::Filters </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#filter">filter</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QFileIconProvider *</td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#iconProvider">iconProvider</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QModelIndex </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#index-1">index</a></b>(const QString &amp;<i>path</i>, int <i>column</i> = 0) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#isDir">isDir</a></b>(const QModelIndex &amp;<i>index</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#readOnly-prop">isReadOnly</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDateTime </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#lastModified">lastModified</a></b>(const QModelIndex &amp;<i>index</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QModelIndex </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#mkdir">mkdir</a></b>(const QModelIndex &amp;<i>parent</i>, const QString &amp;<i>name</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVariant </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#myComputer">myComputer</a></b>(int <i>role</i> = Qt::DisplayRole) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#nameFilterDisables-prop">nameFilterDisables</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#nameFilters">nameFilters</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QFile::Permissions </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#permissions">permissions</a></b>(const QModelIndex &amp;<i>index</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#remove">remove</a></b>(const QModelIndex &amp;<i>index</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#resolveSymlinks-prop">resolveSymlinks</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#rmdir">rmdir</a></b>(const QModelIndex &amp;<i>index</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDir </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#rootDirectory">rootDirectory</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#rootPath">rootPath</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#setFilter">setFilter</a></b>(QDir::Filters <i>filters</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#setIconProvider">setIconProvider</a></b>(QFileIconProvider *<i>provider</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#nameFilterDisables-prop">setNameFilterDisables</a></b>(bool <i>enable</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#setNameFilters">setNameFilters</a></b>(const QStringList &amp;<i>filters</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#readOnly-prop">setReadOnly</a></b>(bool <i>enable</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#resolveSymlinks-prop">setResolveSymlinks</a></b>(bool <i>enable</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QModelIndex </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#setRootPath">setRootPath</a></b>(const QString &amp;<i>newPath</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qint64 </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#size">size</a></b>(const QModelIndex &amp;<i>index</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#type">type</a></b>(const QModelIndex &amp;<i>index</i>) const</td></tr>
</table></div>
<a name="reimplemented-public-functions"></a>
<h2 id="reimplemented-public-functions">Reimplemented Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#canFetchMore">canFetchMore</a></b>(const QModelIndex &amp;<i>parent</i>) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#columnCount">columnCount</a></b>(const QModelIndex &amp;<i>parent</i> = QModelIndex()) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QVariant </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#data">data</a></b>(const QModelIndex &amp;<i>index</i>, int <i>role</i> = Qt::DisplayRole) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#dropMimeData">dropMimeData</a></b>(const QMimeData *<i>data</i>, Qt::DropAction <i>action</i>, int <i>row</i>, int <i>column</i>, const QModelIndex &amp;<i>parent</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#fetchMore">fetchMore</a></b>(const QModelIndex &amp;<i>parent</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual Qt::ItemFlags </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#flags">flags</a></b>(const QModelIndex &amp;<i>index</i>) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#hasChildren">hasChildren</a></b>(const QModelIndex &amp;<i>parent</i> = QModelIndex()) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QVariant </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#headerData">headerData</a></b>(int <i>section</i>, Qt::Orientation <i>orientation</i>, int <i>role</i> = Qt::DisplayRole) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QModelIndex </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#index">index</a></b>(int <i>row</i>, int <i>column</i>, const QModelIndex &amp;<i>parent</i> = QModelIndex()) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QMimeData *</td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#mimeData">mimeData</a></b>(const QModelIndexList &amp;<i>indexes</i>) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QStringList </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#mimeTypes">mimeTypes</a></b>() const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QModelIndex </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#parent">parent</a></b>(const QModelIndex &amp;<i>index</i>) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#rowCount">rowCount</a></b>(const QModelIndex &amp;<i>parent</i> = QModelIndex()) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#setData">setData</a></b>(const QModelIndex &amp;<i>idx</i>, const QVariant &amp;<i>value</i>, int <i>role</i> = Qt::EditRole) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QModelIndex </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#sibling">sibling</a></b>(int <i>row</i>, int <i>column</i>, const QModelIndex &amp;<i>idx</i>) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#sort">sort</a></b>(int <i>column</i>, Qt::SortOrder <i>order</i> = Qt::AscendingOrder) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual Qt::DropActions </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#supportedDropActions">supportedDropActions</a></b>() const override</td></tr>
</table></div>
<ul>
<li class="fn">43 public functions inherited from <a href="../qtcore/qabstractitemmodel.html#public-functions">QAbstractItemModel</a></li>
<li class="fn">34 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#directoryLoaded">directoryLoaded</a></b>(const QString &amp;<i>path</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#fileRenamed">fileRenamed</a></b>(const QString &amp;<i>path</i>, const QString &amp;<i>oldName</i>, const QString &amp;<i>newName</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#rootPathChanged">rootPathChanged</a></b>(const QString &amp;<i>newPath</i>)</td></tr>
</table></div>
<ul>
<li class="fn">18 signals inherited from <a href="../qtcore/qabstractitemmodel.html#signals">QAbstractItemModel</a></li>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li>
</ul>
<a name="reimplemented-protected-functions"></a>
<h2 id="reimplemented-protected-functions">Reimplemented Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#event">event</a></b>(QEvent *<i>event</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qfilesystemmodel.html#timerEvent">timerEvent</a></b>(QTimerEvent *<i>event</i>) override</td></tr>
</table></div>
<ul>
<li class="fn">19 protected functions inherited from <a href="../qtcore/qabstractitemmodel.html#protected-functions">QAbstractItemModel</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">2 public slots inherited from <a href="../qtcore/qabstractitemmodel.html#public-slots">QAbstractItemModel</a></li>
<li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li>
<li class="fn">1 public variable inherited from <a href="../qtcore/qabstractitemmodel.html#public-variables">QAbstractItemModel</a></li>
<li class="fn">1 public variable inherited from <a href="../qtcore/qobject.html#public-variables">QObject</a></li>
<li class="fn">2 static public members inherited from <a href="../qtcore/qabstractitemmodel.html#static-public-members">QAbstractItemModel</a></li>
<li class="fn">10 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li>
<li class="fn">19 protected functions inherited from <a href="../qtcore/qabstractitemmodel.html#protected-functions">QAbstractItemModel</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
<li class="fn">1 protected slot inherited from <a href="../qtcore/qabstractitemmodel.html#protected-slots">QAbstractItemModel</a></li>
<li class="fn">2 protected variables inherited from <a href="../qtcore/qobject.html#protected-variables">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QFileSystemModel-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qfilesystemmodel.html">QFileSystemModel</a> class provides a data model for the local filesystem.</p>
<p>This class provides access to the local filesystem, providing functions for renaming and removing files and directories, and for creating new directories. In the simplest case, it can be used with a suitable display widget as part of a browser or filter.</p>
<p><a href="qfilesystemmodel.html">QFileSystemModel</a> can be accessed using the standard interface provided by <a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a>, but it also provides some convenience functions that are specific to a directory model. The <a href="qfilesystemmodel.html#fileInfo">fileInfo</a>(), <a href="qfilesystemmodel.html#isDir">isDir</a>(), <a href="qfilesystemmodel.html#fileName">fileName</a>() and <a href="qfilesystemmodel.html#filePath">filePath</a>() functions provide information about the underlying files and directories related to items in the model. Directories can be created and removed using <a href="qfilesystemmodel.html#mkdir">mkdir</a>(), <a href="qfilesystemmodel.html#rmdir">rmdir</a>().</p>
<p><b>Note: </b><a href="qfilesystemmodel.html">QFileSystemModel</a> requires an instance of <a href="qapplication.html">QApplication</a>.</p><a name="example-usage"></a>
<h3 >Example Usage</h3>
<p>A directory model that displays the contents of a default directory is usually constructed with a parent object:</p>
<pre class="cpp">

      <span class="type"><a href="qfilesystemmodel.html#QFileSystemModel">QFileSystemModel</a></span> <span class="operator">*</span>model <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qfilesystemmodel.html#QFileSystemModel">QFileSystemModel</a></span>;
      model<span class="operator">-</span><span class="operator">&gt;</span>setRootPath(<span class="type"><a href="../qtcore/qdir.html">QDir</a></span><span class="operator">::</span>currentPath());

</pre>
<p>A tree view can be used to display the contents of the model</p>
<pre class="cpp">

      <span class="type"><a href="qtreeview.html">QTreeView</a></span> <span class="operator">*</span>tree <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qtreeview.html">QTreeView</a></span>(splitter);
      tree<span class="operator">-</span><span class="operator">&gt;</span>setModel(model);

</pre>
<p>and the contents of a particular directory can be displayed by setting the tree view's root index:</p>
<pre class="cpp">

      tree<span class="operator">-</span><span class="operator">&gt;</span>setRootIndex(model<span class="operator">-</span><span class="operator">&gt;</span>index(<span class="type"><a href="../qtcore/qdir.html">QDir</a></span><span class="operator">::</span>currentPath()));

</pre>
<p>The view's root index can be used to control how much of a hierarchical model is displayed. <a href="qfilesystemmodel.html">QFileSystemModel</a> provides a convenience function that returns a suitable model index for a path to a directory within the model.</p>
<a name="caching-and-performance"></a>
<h3 >Caching and Performance</h3>
<p><a href="qfilesystemmodel.html">QFileSystemModel</a> will not fetch any files or directories until <a href="qfilesystemmodel.html#setRootPath">setRootPath</a>() is called. This will prevent any unnecessary querying on the file system until that point such as listing the drives on Windows.</p>
<p>Unlike QDirModel, <a href="qfilesystemmodel.html">QFileSystemModel</a> uses a separate thread to populate itself so it will not cause the main thread to hang as the file system is being queried. Calls to <a href="qfilesystemmodel.html#rowCount">rowCount</a>() will return 0 until the model populates a directory.</p>
<p><a href="qfilesystemmodel.html">QFileSystemModel</a> keeps a cache with file information. The cache is automatically kept up to date using the <a href="../qtcore/qfilesystemwatcher.html">QFileSystemWatcher</a>.</p>
</div>
<p><b>See also </b><a href="model-view-programming.html#model-classes">Model Classes</a>.</p>
<!-- @@@QFileSystemModel -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$Roles$$$FileIconRole$$$FilePathRole$$$FileNameRole$$$FilePermissions -->
<h3 class="fn" id="Roles-enum"><a name="Roles-enum"></a>enum QFileSystemModel::<span class="name">Roles</span></h3>
<div class="table"><table class="valuelist"><tr><th class="tblConst">Constant</th><th class="tblVal">Value</th></tr>
<tr><td class="topAlign"><code>QFileSystemModel::FileIconRole</code></td><td class="topAlign tblval"><code>Qt::DecorationRole</code></td></tr>
<tr><td class="topAlign"><code>QFileSystemModel::FilePathRole</code></td><td class="topAlign tblval"><code>Qt::UserRole + 1</code></td></tr>
<tr><td class="topAlign"><code>QFileSystemModel::FileNameRole</code></td><td class="topAlign tblval"><code>Qt::UserRole + 2</code></td></tr>
<tr><td class="topAlign"><code>QFileSystemModel::FilePermissions</code></td><td class="topAlign tblval"><code>Qt::UserRole + 3</code></td></tr>
</table></div>
<!-- @@@Roles -->
</div>
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$nameFilterDisables-prop$$$nameFilterDisables$$$setNameFilterDisablesbool -->
<h3 class="fn" id="nameFilterDisables-prop"><a name="nameFilterDisables-prop"></a><span class="name">nameFilterDisables</span> : <span class="type">bool</span></h3>
<p>This property holds whether files that don't pass the name filter are hidden or disabled</p>
<p>This property is <code>true</code> by default</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>nameFilterDisables</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setNameFilterDisables</b></span>(bool <i>enable</i>)</td></tr>
</table></div>
<!-- @@@nameFilterDisables -->
<!-- $$$readOnly-prop$$$isReadOnly$$$setReadOnlybool -->
<h3 class="fn" id="readOnly-prop"><a name="readOnly-prop"></a><span class="name">readOnly</span> : <span class="type">bool</span></h3>
<p>This property holds whether the directory model allows writing to the file system</p>
<p>If this property is set to false, the directory model will allow renaming, copying and deleting of files and directories.</p>
<p>This property is <code>true</code> by default</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isReadOnly</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setReadOnly</b></span>(bool <i>enable</i>)</td></tr>
</table></div>
<!-- @@@readOnly -->
<!-- $$$resolveSymlinks-prop$$$resolveSymlinks$$$setResolveSymlinksbool -->
<h3 class="fn" id="resolveSymlinks-prop"><a name="resolveSymlinks-prop"></a><span class="name">resolveSymlinks</span> : <span class="type">bool</span></h3>
<p>This property holds whether the directory model should resolve symbolic links</p>
<p>This is only relevant on Windows.</p>
<p>By default, this property is <code>true</code>.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>resolveSymlinks</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setResolveSymlinks</b></span>(bool <i>enable</i>)</td></tr>
</table></div>
<!-- @@@resolveSymlinks -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QFileSystemModel[overload1]$$$QFileSystemModelQObject* -->
<h3 class="fn" id="QFileSystemModel"><a name="QFileSystemModel"></a>QFileSystemModel::<span class="name">QFileSystemModel</span>(<span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = nullptr)</h3>
<p>Constructs a file system model with the given <i>parent</i>.</p>
<!-- @@@QFileSystemModel -->
<!-- $$$~QFileSystemModel[overload1]$$$~QFileSystemModel -->
<h3 class="fn" id="dtor.QFileSystemModel"><a name="dtor.QFileSystemModel"></a><code>[virtual] </code>QFileSystemModel::<span class="name">~QFileSystemModel</span>()</h3>
<p>Destroys this file system model.</p>
<!-- @@@~QFileSystemModel -->
<!-- $$$canFetchMore[overload1]$$$canFetchMoreconstQModelIndex& -->
<h3 class="fn" id="canFetchMore"><a name="canFetchMore"></a><code>[override virtual] </code><span class="type">bool</span> QFileSystemModel::<span class="name">canFetchMore</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i>) const</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#canFetchMore">QAbstractItemModel::canFetchMore</a>().</p>
<!-- @@@canFetchMore -->
<!-- $$$columnCount[overload1]$$$columnCountconstQModelIndex& -->
<h3 class="fn" id="columnCount"><a name="columnCount"></a><code>[override virtual] </code><span class="type">int</span> QFileSystemModel::<span class="name">columnCount</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i> = QModelIndex()) const</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#columnCount">QAbstractItemModel::columnCount</a>().</p>
<!-- @@@columnCount -->
<!-- $$$data[overload1]$$$dataconstQModelIndex&int -->
<h3 class="fn" id="data"><a name="data"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> QFileSystemModel::<span class="name">data</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>, <span class="type">int</span> <i>role</i> = Qt::DisplayRole) const</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#data">QAbstractItemModel::data</a>().</p>
<p><b>See also </b><a href="qfilesystemmodel.html#setData">setData</a>().</p>
<!-- @@@data -->
<!-- $$$directoryLoaded[overload1]$$$directoryLoadedconstQString& -->
<h3 class="fn" id="directoryLoaded"><a name="directoryLoaded"></a><code>[signal] </code><span class="type">void</span> QFileSystemModel::<span class="name">directoryLoaded</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>path</i>)</h3>
<p>This signal is emitted when the gatherer thread has finished to load the <i>path</i>.</p>
<p>This function was introduced in  Qt 4.7.</p>
<!-- @@@directoryLoaded -->
<!-- $$$dropMimeData[overload1]$$$dropMimeDataconstQMimeData*Qt::DropActionintintconstQModelIndex& -->
<h3 class="fn" id="dropMimeData"><a name="dropMimeData"></a><code>[override virtual] </code><span class="type">bool</span> QFileSystemModel::<span class="name">dropMimeData</span>(const <span class="type"><a href="../qtcore/qmimedata.html">QMimeData</a></span> *<i>data</i>, <span class="type">Qt::DropAction</span> <i>action</i>, <span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>column</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i>)</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#dropMimeData">QAbstractItemModel::dropMimeData</a>().</p>
<p>Handles the <i>data</i> supplied by a drag and drop operation that ended with the given <i>action</i> over the row in the model specified by the <i>row</i> and <i>column</i> and by the <i>parent</i> index.</p>
<p><b>See also </b><a href="qfilesystemmodel.html#supportedDropActions">supportedDropActions</a>().</p>
<!-- @@@dropMimeData -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn" id="event"><a name="event"></a><code>[override virtual protected] </code><span class="type">bool</span> QFileSystemModel::<span class="name">event</span>(<span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="../qtcore/qobject.html#event">QObject::event</a>().</p>
<!-- @@@event -->
<!-- $$$fetchMore[overload1]$$$fetchMoreconstQModelIndex& -->
<h3 class="fn" id="fetchMore"><a name="fetchMore"></a><code>[override virtual] </code><span class="type">void</span> QFileSystemModel::<span class="name">fetchMore</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i>)</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#fetchMore">QAbstractItemModel::fetchMore</a>().</p>
<!-- @@@fetchMore -->
<!-- $$$fileIcon[overload1]$$$fileIconconstQModelIndex& -->
<h3 class="fn" id="fileIcon"><a name="fileIcon"></a><span class="type"><a href="../qtgui/qicon.html">QIcon</a></span> QFileSystemModel::<span class="name">fileIcon</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Returns the icon for the item stored in the model under the given <i>index</i>.</p>
<!-- @@@fileIcon -->
<!-- $$$fileInfo[overload1]$$$fileInfoconstQModelIndex& -->
<h3 class="fn" id="fileInfo"><a name="fileInfo"></a><span class="type"><a href="../qtcore/qfileinfo.html">QFileInfo</a></span> QFileSystemModel::<span class="name">fileInfo</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Returns the <a href="../qtcore/qfileinfo.html">QFileInfo</a> for the item stored in the model under the given <i>index</i>.</p>
<!-- @@@fileInfo -->
<!-- $$$fileName[overload1]$$$fileNameconstQModelIndex& -->
<h3 class="fn" id="fileName"><a name="fileName"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QFileSystemModel::<span class="name">fileName</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Returns the file name for the item stored in the model under the given <i>index</i>.</p>
<!-- @@@fileName -->
<!-- $$$filePath[overload1]$$$filePathconstQModelIndex& -->
<h3 class="fn" id="filePath"><a name="filePath"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QFileSystemModel::<span class="name">filePath</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Returns the path of the item stored in the model under the <i>index</i> given.</p>
<!-- @@@filePath -->
<!-- $$$fileRenamed[overload1]$$$fileRenamedconstQString&constQString&constQString& -->
<h3 class="fn" id="fileRenamed"><a name="fileRenamed"></a><code>[signal] </code><span class="type">void</span> QFileSystemModel::<span class="name">fileRenamed</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>path</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>oldName</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>newName</i>)</h3>
<p>This signal is emitted whenever a file with the <i>oldName</i> is successfully renamed to <i>newName</i>. The file is located in in the directory <i>path</i>.</p>
<!-- @@@fileRenamed -->
<!-- $$$filter[overload1]$$$filter -->
<h3 class="fn" id="filter"><a name="filter"></a><span class="type"><a href="../qtcore/qdir.html#Filter-enum">QDir::Filters</a></span> QFileSystemModel::<span class="name">filter</span>() const</h3>
<p>Returns the filter specified for the directory model.</p>
<p>If a filter has not been set, the default filter is <a href="../qtcore/qdir.html#Filter-enum">QDir::AllEntries</a> | <a href="../qtcore/qdir.html#Filter-enum">QDir::NoDotAndDotDot</a> | <a href="../qtcore/qdir.html#Filter-enum">QDir::AllDirs</a>.</p>
<p><b>See also </b><a href="qfilesystemmodel.html#setFilter">setFilter</a>() and <a href="../qtcore/qdir.html#Filter-enum">QDir::Filters</a>.</p>
<!-- @@@filter -->
<!-- $$$flags[overload1]$$$flagsconstQModelIndex& -->
<h3 class="fn" id="flags"><a name="flags"></a><code>[override virtual] </code><span class="type">Qt::ItemFlags</span> QFileSystemModel::<span class="name">flags</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#flags">QAbstractItemModel::flags</a>().</p>
<!-- @@@flags -->
<!-- $$$hasChildren[overload1]$$$hasChildrenconstQModelIndex& -->
<h3 class="fn" id="hasChildren"><a name="hasChildren"></a><code>[override virtual] </code><span class="type">bool</span> QFileSystemModel::<span class="name">hasChildren</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i> = QModelIndex()) const</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#hasChildren">QAbstractItemModel::hasChildren</a>().</p>
<!-- @@@hasChildren -->
<!-- $$$headerData[overload1]$$$headerDataintQt::Orientationint -->
<h3 class="fn" id="headerData"><a name="headerData"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> QFileSystemModel::<span class="name">headerData</span>(<span class="type">int</span> <i>section</i>, <span class="type">Qt::Orientation</span> <i>orientation</i>, <span class="type">int</span> <i>role</i> = Qt::DisplayRole) const</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#headerData">QAbstractItemModel::headerData</a>().</p>
<!-- @@@headerData -->
<!-- $$$iconProvider[overload1]$$$iconProvider -->
<h3 class="fn" id="iconProvider"><a name="iconProvider"></a><span class="type"><a href="qfileiconprovider.html">QFileIconProvider</a></span> *QFileSystemModel::<span class="name">iconProvider</span>() const</h3>
<p>Returns the file icon provider for this directory model.</p>
<p><b>See also </b><a href="qfilesystemmodel.html#setIconProvider">setIconProvider</a>().</p>
<!-- @@@iconProvider -->
<!-- $$$index[overload1]$$$indexintintconstQModelIndex& -->
<h3 class="fn" id="index"><a name="index"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> QFileSystemModel::<span class="name">index</span>(<span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>column</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i> = QModelIndex()) const</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#index">QAbstractItemModel::index</a>().</p>
<!-- @@@index -->
<!-- $$$index$$$indexconstQString&int -->
<h3 class="fn" id="index-1"><a name="index-1"></a><span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> QFileSystemModel::<span class="name">index</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>path</i>, <span class="type">int</span> <i>column</i> = 0) const</h3>
<p>This is an overloaded function.</p>
<p>Returns the model item index for the given <i>path</i> and <i>column</i>.</p>
<!-- @@@index -->
<!-- $$$isDir[overload1]$$$isDirconstQModelIndex& -->
<h3 class="fn" id="isDir"><a name="isDir"></a><span class="type">bool</span> QFileSystemModel::<span class="name">isDir</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Returns <code>true</code> if the model item <i>index</i> represents a directory; otherwise returns <code>false</code>.</p>
<!-- @@@isDir -->
<!-- $$$lastModified[overload1]$$$lastModifiedconstQModelIndex& -->
<h3 class="fn" id="lastModified"><a name="lastModified"></a><span class="type"><a href="../qtcore/qdatetime.html">QDateTime</a></span> QFileSystemModel::<span class="name">lastModified</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Returns the date and time when <i>index</i> was last modified.</p>
<!-- @@@lastModified -->
<!-- $$$mimeData[overload1]$$$mimeDataconstQModelIndexList& -->
<h3 class="fn" id="mimeData"><a name="mimeData"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qmimedata.html">QMimeData</a></span> *QFileSystemModel::<span class="name">mimeData</span>(const <span class="type"><a href="../qtcore/qmodelindex.html#QModelIndexList-typedef">QModelIndexList</a></span> &amp;<i>indexes</i>) const</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#mimeData">QAbstractItemModel::mimeData</a>().</p>
<p>Returns an object that contains a serialized description of the specified <i>indexes</i>. The format used to describe the items corresponding to the indexes is obtained from the <a href="qfilesystemmodel.html#mimeTypes">mimeTypes</a>() function.</p>
<p>If the list of indexes is empty, 0 is returned rather than a serialized empty list.</p>
<!-- @@@mimeData -->
<!-- $$$mimeTypes[overload1]$$$mimeTypes -->
<h3 class="fn" id="mimeTypes"><a name="mimeTypes"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></span> QFileSystemModel::<span class="name">mimeTypes</span>() const</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#mimeTypes">QAbstractItemModel::mimeTypes</a>().</p>
<p>Returns a list of MIME types that can be used to describe a list of items in the model.</p>
<!-- @@@mimeTypes -->
<!-- $$$mkdir[overload1]$$$mkdirconstQModelIndex&constQString& -->
<h3 class="fn" id="mkdir"><a name="mkdir"></a><span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> QFileSystemModel::<span class="name">mkdir</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>name</i>)</h3>
<p>Create a directory with the <i>name</i> in the <i>parent</i> model index.</p>
<!-- @@@mkdir -->
<!-- $$$myComputer[overload1]$$$myComputerint -->
<h3 class="fn" id="myComputer"><a name="myComputer"></a><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> QFileSystemModel::<span class="name">myComputer</span>(<span class="type">int</span> <i>role</i> = Qt::DisplayRole) const</h3>
<p>Returns the data stored under the given <i>role</i> for the item &quot;My Computer&quot;.</p>
<p><b>See also </b><a href="../qtcore/qt.html#ItemDataRole-enum">Qt::ItemDataRole</a>.</p>
<!-- @@@myComputer -->
<!-- $$$nameFilters[overload1]$$$nameFilters -->
<h3 class="fn" id="nameFilters"><a name="nameFilters"></a><span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></span> QFileSystemModel::<span class="name">nameFilters</span>() const</h3>
<p>Returns a list of filters applied to the names in the model.</p>
<p><b>See also </b><a href="qfilesystemmodel.html#setNameFilters">setNameFilters</a>().</p>
<!-- @@@nameFilters -->
<!-- $$$parent[overload1]$$$parentconstQModelIndex& -->
<h3 class="fn" id="parent"><a name="parent"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> QFileSystemModel::<span class="name">parent</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#parent">QAbstractItemModel::parent</a>().</p>
<!-- @@@parent -->
<!-- $$$permissions[overload1]$$$permissionsconstQModelIndex& -->
<h3 class="fn" id="permissions"><a name="permissions"></a><span class="type"><a href="../qtcore/qfiledevice.html#Permission-enum">QFile::Permissions</a></span> QFileSystemModel::<span class="name">permissions</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Returns the complete OR-ed together combination of <a href="../qtcore/qfiledevice.html#Permission-enum">QFile::Permission</a> for the <i>index</i>.</p>
<!-- @@@permissions -->
<!-- $$$remove[overload1]$$$removeconstQModelIndex& -->
<h3 class="fn" id="remove"><a name="remove"></a><span class="type">bool</span> QFileSystemModel::<span class="name">remove</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>)</h3>
<p>Removes the model item <i>index</i> from the file system model and <b>deletes the corresponding file from the file system</b>, returning true if successful. If the item cannot be removed, false is returned.</p>
<p><b>Warning:</b> This function deletes files from the file system; it does <b>not</b> move them to a location where they can be recovered.</p>
<p><b>See also </b><a href="qfilesystemmodel.html#rmdir">rmdir</a>().</p>
<!-- @@@remove -->
<!-- $$$rmdir[overload1]$$$rmdirconstQModelIndex& -->
<h3 class="fn" id="rmdir"><a name="rmdir"></a><span class="type">bool</span> QFileSystemModel::<span class="name">rmdir</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>)</h3>
<p>Removes the directory corresponding to the model item <i>index</i> in the file system model and <b>deletes the corresponding directory from the file system</b>, returning true if successful. If the directory cannot be removed, false is returned.</p>
<p><b>Warning:</b> This function deletes directories from the file system; it does <b>not</b> move them to a location where they can be recovered.</p>
<p><b>See also </b><a href="qfilesystemmodel.html#remove">remove</a>().</p>
<!-- @@@rmdir -->
<!-- $$$rootDirectory[overload1]$$$rootDirectory -->
<h3 class="fn" id="rootDirectory"><a name="rootDirectory"></a><span class="type"><a href="../qtcore/qdir.html">QDir</a></span> QFileSystemModel::<span class="name">rootDirectory</span>() const</h3>
<p>The currently set directory</p>
<p><b>See also </b><a href="qfilesystemmodel.html#rootPath">rootPath</a>().</p>
<!-- @@@rootDirectory -->
<!-- $$$rootPath[overload1]$$$rootPath -->
<h3 class="fn" id="rootPath"><a name="rootPath"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QFileSystemModel::<span class="name">rootPath</span>() const</h3>
<p>The currently set root path</p>
<p><b>See also </b><a href="qfilesystemmodel.html#setRootPath">setRootPath</a>() and <a href="qfilesystemmodel.html#rootDirectory">rootDirectory</a>().</p>
<!-- @@@rootPath -->
<!-- $$$rootPathChanged[overload1]$$$rootPathChangedconstQString& -->
<h3 class="fn" id="rootPathChanged"><a name="rootPathChanged"></a><code>[signal] </code><span class="type">void</span> QFileSystemModel::<span class="name">rootPathChanged</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>newPath</i>)</h3>
<p>This signal is emitted whenever the root path has been changed to a <i>newPath</i>.</p>
<!-- @@@rootPathChanged -->
<!-- $$$rowCount[overload1]$$$rowCountconstQModelIndex& -->
<h3 class="fn" id="rowCount"><a name="rowCount"></a><code>[override virtual] </code><span class="type">int</span> QFileSystemModel::<span class="name">rowCount</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i> = QModelIndex()) const</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#rowCount">QAbstractItemModel::rowCount</a>().</p>
<!-- @@@rowCount -->
<!-- $$$setData[overload1]$$$setDataconstQModelIndex&constQVariant&int -->
<h3 class="fn" id="setData"><a name="setData"></a><code>[override virtual] </code><span class="type">bool</span> QFileSystemModel::<span class="name">setData</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>idx</i>, const <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> &amp;<i>value</i>, <span class="type">int</span> <i>role</i> = Qt::EditRole)</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#setData">QAbstractItemModel::setData</a>().</p>
<p><b>See also </b><a href="qfilesystemmodel.html#data">data</a>().</p>
<!-- @@@setData -->
<!-- $$$setFilter[overload1]$$$setFilterQDir::Filters -->
<h3 class="fn" id="setFilter"><a name="setFilter"></a><span class="type">void</span> QFileSystemModel::<span class="name">setFilter</span>(<span class="type"><a href="../qtcore/qdir.html#Filter-enum">QDir::Filters</a></span> <i>filters</i>)</h3>
<p>Sets the directory model's filter to that specified by <i>filters</i>.</p>
<p>Note that the filter you set should always include the <a href="../qtcore/qdir.html#Filter-enum">QDir::AllDirs</a> enum value, otherwise <a href="qfilesystemmodel.html">QFileSystemModel</a> won't be able to read the directory structure.</p>
<p><b>See also </b><a href="qfilesystemmodel.html#filter">filter</a>() and <a href="../qtcore/qdir.html#Filter-enum">QDir::Filters</a>.</p>
<!-- @@@setFilter -->
<!-- $$$setIconProvider[overload1]$$$setIconProviderQFileIconProvider* -->
<h3 class="fn" id="setIconProvider"><a name="setIconProvider"></a><span class="type">void</span> QFileSystemModel::<span class="name">setIconProvider</span>(<span class="type"><a href="qfileiconprovider.html">QFileIconProvider</a></span> *<i>provider</i>)</h3>
<p>Sets the <i>provider</i> of file icons for the directory model.</p>
<p><b>See also </b><a href="qfilesystemmodel.html#iconProvider">iconProvider</a>().</p>
<!-- @@@setIconProvider -->
<!-- $$$setNameFilters[overload1]$$$setNameFiltersconstQStringList& -->
<h3 class="fn" id="setNameFilters"><a name="setNameFilters"></a><span class="type">void</span> QFileSystemModel::<span class="name">setNameFilters</span>(const <span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></span> &amp;<i>filters</i>)</h3>
<p>Sets the name <i>filters</i> to apply against the existing files.</p>
<p><b>See also </b><a href="qfilesystemmodel.html#nameFilters">nameFilters</a>().</p>
<!-- @@@setNameFilters -->
<!-- $$$setRootPath[overload1]$$$setRootPathconstQString& -->
<h3 class="fn" id="setRootPath"><a name="setRootPath"></a><span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> QFileSystemModel::<span class="name">setRootPath</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>newPath</i>)</h3>
<p>Sets the directory that is being watched by the model to <i>newPath</i> by installing a <a href="../qtcore/qfilesystemwatcher.html">file system watcher</a> on it. Any changes to files and directories within this directory will be reflected in the model.</p>
<p>If the path is changed, the <a href="qfilesystemmodel.html#rootPathChanged">rootPathChanged</a>() signal will be emitted.</p>
<p><b>Note: </b>This function does not change the structure of the model or modify the data available to views. In other words, the &quot;root&quot; of the model is <i>not</i> changed to include only files and directories within the directory specified by <i>newPath</i> in the file system.</p><p><b>See also </b><a href="qfilesystemmodel.html#rootPath">rootPath</a>().</p>
<!-- @@@setRootPath -->
<!-- $$$sibling[overload1]$$$siblingintintconstQModelIndex& -->
<h3 class="fn" id="sibling"><a name="sibling"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> QFileSystemModel::<span class="name">sibling</span>(<span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>column</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>idx</i>) const</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#sibling">QAbstractItemModel::sibling</a>().</p>
<!-- @@@sibling -->
<!-- $$$size[overload1]$$$sizeconstQModelIndex& -->
<h3 class="fn" id="size"><a name="size"></a><span class="type"><a href="../qtcore/qtglobal.html#qint64-typedef">qint64</a></span> QFileSystemModel::<span class="name">size</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Returns the size in bytes of <i>index</i>. If the file does not exist, 0 is returned.</p>
<!-- @@@size -->
<!-- $$$sort[overload1]$$$sortintQt::SortOrder -->
<h3 class="fn" id="sort"><a name="sort"></a><code>[override virtual] </code><span class="type">void</span> QFileSystemModel::<span class="name">sort</span>(<span class="type">int</span> <i>column</i>, <span class="type">Qt::SortOrder</span> <i>order</i> = Qt::AscendingOrder)</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#sort">QAbstractItemModel::sort</a>().</p>
<!-- @@@sort -->
<!-- $$$supportedDropActions[overload1]$$$supportedDropActions -->
<h3 class="fn" id="supportedDropActions"><a name="supportedDropActions"></a><code>[override virtual] </code><span class="type">Qt::DropActions</span> QFileSystemModel::<span class="name">supportedDropActions</span>() const</h3>
<p>Reimplemented from <a href="../qtcore/qabstractitemmodel.html#supportedDropActions">QAbstractItemModel::supportedDropActions</a>().</p>
<!-- @@@supportedDropActions -->
<!-- $$$timerEvent[overload1]$$$timerEventQTimerEvent* -->
<h3 class="fn" id="timerEvent"><a name="timerEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QFileSystemModel::<span class="name">timerEvent</span>(<span class="type"><a href="../qtcore/qtimerevent.html">QTimerEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="../qtcore/qobject.html#timerEvent">QObject::timerEvent</a>().</p>
<!-- @@@timerEvent -->
<!-- $$$type[overload1]$$$typeconstQModelIndex& -->
<h3 class="fn" id="type"><a name="type"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QFileSystemModel::<span class="name">type</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Returns the type of file <i>index</i> such as &quot;Directory&quot; or &quot;JPEG file&quot;.</p>
<!-- @@@type -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2018 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>