qfileinfo.html 68 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 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qfileinfo.cpp -->
  <title>QFileInfo Class | Qt Core 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="qtcore-index.html">Qt Core</a></td><td ><a href="qtcore-module.html">C++ Classes</a></td><td >QFileInfo</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-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#related-non-members">Related Non-Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#performance-issues">Performance Issues</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QFileInfo Class</h1>
<!-- $$$QFileInfo-brief -->
<p>The <a href="qfileinfo.html">QFileInfo</a> class provides system-independent file information. <a href="#details">More...</a></p>
<!-- @@@QFileInfo -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QFileInfo&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += core</td></tr></table></div><ul>
<li><a href="qfileinfo-members.html">List of all members, including inherited members</a></li>
<li><a href="qfileinfo-obsolete.html">Obsolete members</a></li>
</ul>
<p><b>Note:</b> All functions in this class are <a href="../qtdoc/threads-reentrancy.html">reentrant</a>.</p>
<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="qfileinfo.html#QFileInfo">QFileInfo</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#QFileInfo-2">QFileInfo</a></b>(const QString &amp;<i>file</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#QFileInfo-3">QFileInfo</a></b>(const QFile &amp;<i>file</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#QFileInfo-4">QFileInfo</a></b>(const QDir &amp;<i>dir</i>, const QString &amp;<i>file</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#QFileInfo-5">QFileInfo</a></b>(const QFileInfo &amp;<i>fileinfo</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#dtor.QFileInfo">~QFileInfo</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDir </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#absoluteDir">absoluteDir</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#absoluteFilePath">absoluteFilePath</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#absolutePath">absolutePath</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#baseName">baseName</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDateTime </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#birthTime">birthTime</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#bundleName">bundleName</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#caching">caching</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#canonicalFilePath">canonicalFilePath</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#canonicalPath">canonicalPath</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#completeBaseName">completeBaseName</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#completeSuffix">completeSuffix</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDir </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#dir">dir</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#exists">exists</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#fileName">fileName</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#filePath">filePath</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDateTime </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#fileTime">fileTime</a></b>(QFile::FileTime <i>time</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#group">group</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> uint </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#groupId">groupId</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#isAbsolute">isAbsolute</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#isBundle">isBundle</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#isDir">isDir</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#isExecutable">isExecutable</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#isFile">isFile</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#isHidden">isHidden</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#isNativePath">isNativePath</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#isReadable">isReadable</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#isRelative">isRelative</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#isRoot">isRoot</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#isSymLink">isSymLink</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#isWritable">isWritable</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDateTime </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#lastModified">lastModified</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDateTime </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#lastRead">lastRead</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#makeAbsolute">makeAbsolute</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDateTime </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#metadataChangeTime">metadataChangeTime</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#owner">owner</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> uint </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#ownerId">ownerId</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#path">path</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#permission">permission</a></b>(QFile::Permissions <i>permissions</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QFile::Permissions </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#permissions">permissions</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#refresh">refresh</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#setCaching">setCaching</a></b>(bool <i>enable</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#setFile">setFile</a></b>(const QString &amp;<i>file</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#setFile-1">setFile</a></b>(const QFile &amp;<i>file</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#setFile-2">setFile</a></b>(const QDir &amp;<i>dir</i>, const QString &amp;<i>file</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qint64 </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#size">size</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#suffix">suffix</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#swap">swap</a></b>(QFileInfo &amp;<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#symLinkTarget">symLinkTarget</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#operator-not-eq">operator!=</a></b>(const QFileInfo &amp;<i>fileinfo</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QFileInfo &amp;</td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#operator-eq">operator=</a></b>(const QFileInfo &amp;<i>fileinfo</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QFileInfo &amp;</td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#operator-eq-1">operator=</a></b>(QFileInfo &amp;&amp;<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#operator-eq-eq">operator==</a></b>(const QFileInfo &amp;<i>fileinfo</i>) const</td></tr>
</table></div>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#exists-1">exists</a></b>(const QString &amp;<i>file</i>)</td></tr>
</table></div>
<a name="related-non-members"></a>
<h2 id="related-non-members">Related Non-Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qfileinfo.html#QFileInfoList-typedef">QFileInfoList</a></b></td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QFileInfo-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qfileinfo.html">QFileInfo</a> class provides system-independent file information.</p>
<p><a href="qfileinfo.html">QFileInfo</a> provides information about a file's name and position (path) in the file system, its access rights and whether it is a directory or symbolic link, etc. The file's size and last modified/read times are also available. <a href="qfileinfo.html">QFileInfo</a> can also be used to obtain information about a Qt <a href="resources.html">resource</a>.</p>
<p>A <a href="qfileinfo.html">QFileInfo</a> can point to a file with either a relative or an absolute file path. Absolute file paths begin with the directory separator &quot;/&quot; (or with a drive specification on Windows). Relative file names begin with a directory name or a file name and specify a path relative to the current working directory. An example of an absolute path is the string &quot;/tmp/quartz&quot;. A relative path might look like &quot;src/fatlib&quot;. You can use the function <a href="qfileinfo.html#isRelative">isRelative</a>() to check whether a <a href="qfileinfo.html">QFileInfo</a> is using a relative or an absolute file path. You can call the function <a href="qfileinfo.html#makeAbsolute">makeAbsolute</a>() to convert a relative <a href="qfileinfo.html">QFileInfo</a>'s path to an absolute path.</p>
<p>The file that the <a href="qfileinfo.html">QFileInfo</a> works on is set in the constructor or later with <a href="qfileinfo.html#setFile">setFile</a>(). Use <a href="qfileinfo.html#exists">exists</a>() to see if the file exists and <a href="qfileinfo.html#size">size</a>() to get its size.</p>
<p>The file's type is obtained with <a href="qfileinfo.html#isFile">isFile</a>(), <a href="qfileinfo.html#isDir">isDir</a>() and <a href="qfileinfo.html#isSymLink">isSymLink</a>(). The <a href="qfileinfo.html#symLinkTarget">symLinkTarget</a>() function provides the name of the file the symlink points to.</p>
<p>On Unix (including <a href="../qtdoc/internationalization.html#macos">macOS</a> and iOS), the symlink has the same <a href="qfileinfo.html#size">size</a>() has the file it points to, because Unix handles symlinks transparently; similarly, opening a symlink using <a href="qfile.html">QFile</a> effectively opens the link's target. For example:</p>
<pre class="cpp">

  <span class="preprocessor">#ifdef Q_OS_UNIX</span>

  <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> info1(<span class="string">&quot;/home/bob/bin/untabify&quot;</span>);
  info1<span class="operator">.</span>isSymLink();          <span class="comment">// returns true</span>
  info1<span class="operator">.</span>absoluteFilePath();   <span class="comment">// returns &quot;/home/bob/bin/untabify&quot;</span>
  info1<span class="operator">.</span>size();               <span class="comment">// returns 56201</span>
  info1<span class="operator">.</span>symLinkTarget();      <span class="comment">// returns &quot;/opt/pretty++/bin/untabify&quot;</span>

  <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> info2(info1<span class="operator">.</span>symLinkTarget());
  info2<span class="operator">.</span>isSymLink();          <span class="comment">// returns false</span>
  info2<span class="operator">.</span>absoluteFilePath();   <span class="comment">// returns &quot;/opt/pretty++/bin/untabify&quot;</span>
  info2<span class="operator">.</span>size();               <span class="comment">// returns 56201</span>

  <span class="preprocessor">#endif</span>

</pre>
<p>On Windows, symlinks (shortcuts) are <code>.lnk</code> files. The reported <a href="qfileinfo.html#size">size</a>() is that of the symlink (not the link's target), and opening a symlink using <a href="qfile.html">QFile</a> opens the <code>.lnk</code> file. For example:</p>
<pre class="cpp">

  <span class="preprocessor">#ifdef Q_OS_WIN</span>

  <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> info1(<span class="string">&quot;C:\\Documents and Settings\\Bob\\untabify.lnk&quot;</span>);
  info1<span class="operator">.</span>isSymLink();          <span class="comment">// returns true</span>
  info1<span class="operator">.</span>absoluteFilePath();   <span class="comment">// returns &quot;C:/Documents and Settings/Bob/untabify.lnk&quot;</span>
  info1<span class="operator">.</span>size();               <span class="comment">// returns 743</span>
  info1<span class="operator">.</span>symLinkTarget();      <span class="comment">// returns &quot;C:/Pretty++/untabify&quot;</span>

  <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> info2(info1<span class="operator">.</span>symLinkTarget());
  info2<span class="operator">.</span>isSymLink();          <span class="comment">// returns false</span>
  info2<span class="operator">.</span>absoluteFilePath();   <span class="comment">// returns &quot;C:/Pretty++/untabify&quot;</span>
  info2<span class="operator">.</span>size();               <span class="comment">// returns 63942</span>

  <span class="preprocessor">#endif</span>

</pre>
<p>Elements of the file's name can be extracted with <a href="qfileinfo.html#path">path</a>() and <a href="qfileinfo.html#fileName">fileName</a>(). The <a href="qfileinfo.html#fileName">fileName</a>()'s parts can be extracted with <a href="qfileinfo.html#baseName">baseName</a>(), <a href="qfileinfo.html#suffix">suffix</a>() or <a href="qfileinfo.html#completeSuffix">completeSuffix</a>(). <a href="qfileinfo.html">QFileInfo</a> objects to directories created by Qt classes will not have a trailing file separator. If you wish to use trailing separators in your own file info objects, just append one to the file name given to the constructors or <a href="qfileinfo.html#setFile">setFile</a>().</p>
<p>The file's dates are returned by created(), <a href="qfileinfo.html#lastModified">lastModified</a>(), <a href="qfileinfo.html#lastRead">lastRead</a>() and <a href="qfileinfo.html#fileTime">fileTime</a>(). Information about the file's access permissions is obtained with <a href="qfileinfo.html#isReadable">isReadable</a>(), <a href="qfileinfo.html#isWritable">isWritable</a>() and <a href="qfileinfo.html#isExecutable">isExecutable</a>(). The file's ownership is available from <a href="qfileinfo.html#owner">owner</a>(), <a href="qfileinfo.html#ownerId">ownerId</a>(), <a href="qfileinfo.html#group">group</a>() and <a href="qfileinfo.html#groupId">groupId</a>(). You can examine a file's permissions and ownership in a single statement using the <a href="qfileinfo.html#permission">permission</a>() function.</p>
<a name="ntfs-permissions"></a><p><b>Note: </b>On NTFS file systems, ownership and permissions checking is disabled by default for performance reasons. To enable it, include the following line:</p><pre class="cpp">

  <span class="keyword">extern</span> Q_CORE_EXPORT <span class="type">int</span> qt_ntfs_permission_lookup;

</pre>
<p>Permission checking is then turned on and off by incrementing and decrementing <code>qt_ntfs_permission_lookup</code> by 1.</p>
<pre class="cpp">

  qt_ntfs_permission_lookup<span class="operator">+</span><span class="operator">+</span>; <span class="comment">// turn checking on</span>
  qt_ntfs_permission_lookup<span class="operator">-</span><span class="operator">-</span>; <span class="comment">// turn it off again</span>

</pre>
<a name="performance-issues"></a>
<h3 >Performance Issues</h3>
<p>Some of <a href="qfileinfo.html">QFileInfo</a>'s functions query the file system, but for performance reasons, some functions only operate on the file name itself. For example: To return the absolute path of a relative file name, <a href="qfileinfo.html#absolutePath">absolutePath</a>() has to query the file system. The <a href="qfileinfo.html#path">path</a>() function, however, can work on the file name directly, and so it is faster.</p>
<p><b>Note: </b>To speed up performance, <a href="qfileinfo.html">QFileInfo</a> caches information about the file.</p><p>Because files can be changed by other users or programs, or even by other parts of the same program, there is a function that refreshes the file information: <a href="qfileinfo.html#refresh">refresh</a>(). If you want to switch off a <a href="qfileinfo.html">QFileInfo</a>'s caching and force it to access the file system every time you request information from it call <a href="qfileinfo.html#setCaching">setCaching</a>(false).</p>
</div>
<p><b>See also </b><a href="qdir.html">QDir</a> and <a href="qfile.html">QFile</a>.</p>
<!-- @@@QFileInfo -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QFileInfo[overload1]$$$QFileInfo -->
<h3 class="fn" id="QFileInfo"><a name="QFileInfo"></a>QFileInfo::<span class="name">QFileInfo</span>()</h3>
<p>Constructs an empty <a href="qfileinfo.html">QFileInfo</a> object.</p>
<p>Note that an empty <a href="qfileinfo.html">QFileInfo</a> object contain no file reference.</p>
<p><b>See also </b><a href="qfileinfo.html#setFile">setFile</a>().</p>
<!-- @@@QFileInfo -->
<!-- $$$QFileInfo$$$QFileInfoconstQString& -->
<h3 class="fn" id="QFileInfo-2"><a name="QFileInfo-2"></a>QFileInfo::<span class="name">QFileInfo</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>file</i>)</h3>
<p>Constructs a new <a href="qfileinfo.html">QFileInfo</a> that gives information about the given file. The <i>file</i> can also include an absolute or relative path.</p>
<p><b>See also </b><a href="qfileinfo.html#setFile">setFile</a>(), <a href="qfileinfo.html#isRelative">isRelative</a>(), <a href="qdir.html#setCurrent">QDir::setCurrent</a>(), and <a href="qdir.html#isRelativePath">QDir::isRelativePath</a>().</p>
<!-- @@@QFileInfo -->
<!-- $$$QFileInfo$$$QFileInfoconstQFile& -->
<h3 class="fn" id="QFileInfo-3"><a name="QFileInfo-3"></a>QFileInfo::<span class="name">QFileInfo</span>(const <span class="type"><a href="qfile.html">QFile</a></span> &amp;<i>file</i>)</h3>
<p>Constructs a new <a href="qfileinfo.html">QFileInfo</a> that gives information about file <i>file</i>.</p>
<p>If the <i>file</i> has a relative path, the <a href="qfileinfo.html">QFileInfo</a> will also have a relative path.</p>
<p><b>See also </b><a href="qfileinfo.html#isRelative">isRelative</a>().</p>
<!-- @@@QFileInfo -->
<!-- $$$QFileInfo$$$QFileInfoconstQDir&constQString& -->
<h3 class="fn" id="QFileInfo-4"><a name="QFileInfo-4"></a>QFileInfo::<span class="name">QFileInfo</span>(const <span class="type"><a href="qdir.html">QDir</a></span> &amp;<i>dir</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>file</i>)</h3>
<p>Constructs a new <a href="qfileinfo.html">QFileInfo</a> that gives information about the given <i>file</i> in the directory <i>dir</i>.</p>
<p>If <i>dir</i> has a relative path, the <a href="qfileinfo.html">QFileInfo</a> will also have a relative path.</p>
<p>If <i>file</i> is an absolute path, then the directory specified by <i>dir</i> will be disregarded.</p>
<p><b>See also </b><a href="qfileinfo.html#isRelative">isRelative</a>().</p>
<!-- @@@QFileInfo -->
<!-- $$$QFileInfo$$$QFileInfoconstQFileInfo& -->
<h3 class="fn" id="QFileInfo-5"><a name="QFileInfo-5"></a>QFileInfo::<span class="name">QFileInfo</span>(const <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> &amp;<i>fileinfo</i>)</h3>
<p>Constructs a new <a href="qfileinfo.html">QFileInfo</a> that is a copy of the given <i>fileinfo</i>.</p>
<!-- @@@QFileInfo -->
<!-- $$$~QFileInfo[overload1]$$$~QFileInfo -->
<h3 class="fn" id="dtor.QFileInfo"><a name="dtor.QFileInfo"></a>QFileInfo::<span class="name">~QFileInfo</span>()</h3>
<p>Destroys the <a href="qfileinfo.html">QFileInfo</a> and frees its resources.</p>
<!-- @@@~QFileInfo -->
<!-- $$$absoluteDir[overload1]$$$absoluteDir -->
<h3 class="fn" id="absoluteDir"><a name="absoluteDir"></a><span class="type"><a href="qdir.html">QDir</a></span> QFileInfo::<span class="name">absoluteDir</span>() const</h3>
<p>Returns the file's absolute path as a <a href="qdir.html">QDir</a> object.</p>
<p><b>See also </b><a href="qfileinfo.html#dir">dir</a>(), <a href="qfileinfo.html#filePath">filePath</a>(), <a href="qfileinfo.html#fileName">fileName</a>(), and <a href="qfileinfo.html#isRelative">isRelative</a>().</p>
<!-- @@@absoluteDir -->
<!-- $$$absoluteFilePath[overload1]$$$absoluteFilePath -->
<h3 class="fn" id="absoluteFilePath"><a name="absoluteFilePath"></a><span class="type"><a href="qstring.html">QString</a></span> QFileInfo::<span class="name">absoluteFilePath</span>() const</h3>
<p>Returns an absolute path including the file name.</p>
<p>The absolute path name consists of the full path and the file name. On Unix this will always begin with the root, '/', directory. On Windows this will always begin 'D:/' where D is a drive letter, except for network shares that are not mapped to a drive letter, in which case the path will begin '//sharename/'. <a href="qfileinfo.html">QFileInfo</a> will uppercase drive letters. Note that <a href="qdir.html">QDir</a> does not do this. The code snippet below shows this.</p>
<pre class="cpp">

      <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> fi(<span class="string">&quot;c:/temp/foo&quot;</span>); <span class="operator">=</span><span class="operator">&gt;</span> fi<span class="operator">.</span>absoluteFilePath() <span class="operator">=</span><span class="operator">&gt;</span> <span class="string">&quot;C:/temp/foo&quot;</span>

</pre>
<p>This function returns the same as <a href="qfileinfo.html#filePath">filePath</a>(), unless <a href="qfileinfo.html#isRelative">isRelative</a>() is true. In contrast to <a href="qfileinfo.html#canonicalFilePath">canonicalFilePath</a>(), symbolic links or redundant &quot;.&quot; or &quot;..&quot; elements are not necessarily removed.</p>
<p><b>Warning:</b> If <a href="qfileinfo.html#filePath">filePath</a>() is empty the behavior of this function is undefined.</p>
<p><b>See also </b><a href="qfileinfo.html#filePath">filePath</a>(), <a href="qfileinfo.html#canonicalFilePath">canonicalFilePath</a>(), and <a href="qfileinfo.html#isRelative">isRelative</a>().</p>
<!-- @@@absoluteFilePath -->
<!-- $$$absolutePath[overload1]$$$absolutePath -->
<h3 class="fn" id="absolutePath"><a name="absolutePath"></a><span class="type"><a href="qstring.html">QString</a></span> QFileInfo::<span class="name">absolutePath</span>() const</h3>
<p>Returns a file's path absolute path. This doesn't include the file name.</p>
<p>On Unix the absolute path will always begin with the root, '/', directory. On Windows this will always begin 'D:/' where D is a drive letter, except for network shares that are not mapped to a drive letter, in which case the path will begin '//sharename/'.</p>
<p>In contrast to <a href="qfileinfo.html#canonicalPath">canonicalPath</a>() symbolic links or redundant &quot;.&quot; or &quot;..&quot; elements are not necessarily removed.</p>
<p><b>Warning:</b> If <a href="qfileinfo.html#filePath">filePath</a>() is empty the behavior of this function is undefined.</p>
<p><b>See also </b><a href="qfileinfo.html#absoluteFilePath">absoluteFilePath</a>(), <a href="qfileinfo.html#path">path</a>(), <a href="qfileinfo.html#canonicalPath">canonicalPath</a>(), <a href="qfileinfo.html#fileName">fileName</a>(), and <a href="qfileinfo.html#isRelative">isRelative</a>().</p>
<!-- @@@absolutePath -->
<!-- $$$baseName[overload1]$$$baseName -->
<h3 class="fn" id="baseName"><a name="baseName"></a><span class="type"><a href="qstring.html">QString</a></span> QFileInfo::<span class="name">baseName</span>() const</h3>
<p>Returns the base name of the file without the path.</p>
<p>The base name consists of all characters in the file up to (but not including) the <i>first</i> '.' character.</p>
<p>Example:</p>
<pre class="cpp">

  <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> fi(<span class="string">&quot;/tmp/archive.tar.gz&quot;</span>);
  <span class="type"><a href="qstring.html">QString</a></span> base <span class="operator">=</span> fi<span class="operator">.</span>baseName();  <span class="comment">// base = &quot;archive&quot;</span>

</pre>
<p>The base name of a file is computed equally on all platforms, independent of file naming conventions (e.g&#x2e;, &quot;.bashrc&quot; on Unix has an empty base name, and the suffix is &quot;bashrc&quot;).</p>
<p><b>See also </b><a href="qfileinfo.html#fileName">fileName</a>(), <a href="qfileinfo.html#suffix">suffix</a>(), <a href="qfileinfo.html#completeSuffix">completeSuffix</a>(), and <a href="qfileinfo.html#completeBaseName">completeBaseName</a>().</p>
<!-- @@@baseName -->
<!-- $$$birthTime[overload1]$$$birthTime -->
<h3 class="fn" id="birthTime"><a name="birthTime"></a><span class="type"><a href="qdatetime.html">QDateTime</a></span> QFileInfo::<span class="name">birthTime</span>() const</h3>
<p>Returns the date and time when the file was created / born.</p>
<p>If the file birth time is not available, this function returns an invalid <a href="qdatetime.html">QDateTime</a>.</p>
<p>This function was introduced in  Qt 5.10.</p>
<p><b>See also </b><a href="qfileinfo.html#lastModified">lastModified</a>(), <a href="qfileinfo.html#lastRead">lastRead</a>(), and <a href="qfileinfo.html#metadataChangeTime">metadataChangeTime</a>().</p>
<!-- @@@birthTime -->
<!-- $$$bundleName[overload1]$$$bundleName -->
<h3 class="fn" id="bundleName"><a name="bundleName"></a><span class="type"><a href="qstring.html">QString</a></span> QFileInfo::<span class="name">bundleName</span>() const</h3>
<p>Returns the name of the bundle.</p>
<p>On <a href="../qtdoc/internationalization.html#macos">macOS</a> and iOS this returns the proper localized name for a bundle if the path <a href="qfileinfo.html#isBundle">isBundle</a>(). On all other platforms an empty <a href="qstring.html">QString</a> is returned.</p>
<p>Example:</p>
<pre class="cpp">

  <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> fi(<span class="string">&quot;/Applications/Safari.app&quot;</span>);
  <span class="type"><a href="qstring.html">QString</a></span> bundle <span class="operator">=</span> fi<span class="operator">.</span>bundleName();                <span class="comment">// name = &quot;Safari&quot;</span>

</pre>
<p>This function was introduced in  Qt 4.3.</p>
<p><b>See also </b><a href="qfileinfo.html#isBundle">isBundle</a>(), <a href="qfileinfo.html#filePath">filePath</a>(), <a href="qfileinfo.html#baseName">baseName</a>(), and <a href="qfileinfo.html#suffix">suffix</a>().</p>
<!-- @@@bundleName -->
<!-- $$$caching[overload1]$$$caching -->
<h3 class="fn" id="caching"><a name="caching"></a><span class="type">bool</span> QFileInfo::<span class="name">caching</span>() const</h3>
<p>Returns <code>true</code> if caching is enabled; otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qfileinfo.html#setCaching">setCaching</a>() and <a href="qfileinfo.html#refresh">refresh</a>().</p>
<!-- @@@caching -->
<!-- $$$canonicalFilePath[overload1]$$$canonicalFilePath -->
<h3 class="fn" id="canonicalFilePath"><a name="canonicalFilePath"></a><span class="type"><a href="qstring.html">QString</a></span> QFileInfo::<span class="name">canonicalFilePath</span>() const</h3>
<p>Returns the canonical path including the file name, i.e&#x2e; an absolute path without symbolic links or redundant &quot;.&quot; or &quot;..&quot; elements.</p>
<p>If the file does not exist, canonicalFilePath() returns an empty string.</p>
<p><b>See also </b><a href="qfileinfo.html#filePath">filePath</a>(), <a href="qfileinfo.html#absoluteFilePath">absoluteFilePath</a>(), and <a href="qfileinfo.html#dir">dir</a>().</p>
<!-- @@@canonicalFilePath -->
<!-- $$$canonicalPath[overload1]$$$canonicalPath -->
<h3 class="fn" id="canonicalPath"><a name="canonicalPath"></a><span class="type"><a href="qstring.html">QString</a></span> QFileInfo::<span class="name">canonicalPath</span>() const</h3>
<p>Returns the file's path canonical path (excluding the file name), i.e&#x2e; an absolute path without symbolic links or redundant &quot;.&quot; or &quot;..&quot; elements.</p>
<p>If the file does not exist, canonicalPath() returns an empty string.</p>
<p><b>See also </b><a href="qfileinfo.html#path">path</a>() and <a href="qfileinfo.html#absolutePath">absolutePath</a>().</p>
<!-- @@@canonicalPath -->
<!-- $$$completeBaseName[overload1]$$$completeBaseName -->
<h3 class="fn" id="completeBaseName"><a name="completeBaseName"></a><span class="type"><a href="qstring.html">QString</a></span> QFileInfo::<span class="name">completeBaseName</span>() const</h3>
<p>Returns the complete base name of the file without the path.</p>
<p>The complete base name consists of all characters in the file up to (but not including) the <i>last</i> '.' character.</p>
<p>Example:</p>
<pre class="cpp">

  <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> fi(<span class="string">&quot;/tmp/archive.tar.gz&quot;</span>);
  <span class="type"><a href="qstring.html">QString</a></span> base <span class="operator">=</span> fi<span class="operator">.</span>completeBaseName();  <span class="comment">// base = &quot;archive.tar&quot;</span>

</pre>
<p><b>See also </b><a href="qfileinfo.html#fileName">fileName</a>(), <a href="qfileinfo.html#suffix">suffix</a>(), <a href="qfileinfo.html#completeSuffix">completeSuffix</a>(), and <a href="qfileinfo.html#baseName">baseName</a>().</p>
<!-- @@@completeBaseName -->
<!-- $$$completeSuffix[overload1]$$$completeSuffix -->
<h3 class="fn" id="completeSuffix"><a name="completeSuffix"></a><span class="type"><a href="qstring.html">QString</a></span> QFileInfo::<span class="name">completeSuffix</span>() const</h3>
<p>Returns the complete suffix (extension) of the file.</p>
<p>The complete suffix consists of all characters in the file after (but not including) the first '.'&#x2e;</p>
<p>Example:</p>
<pre class="cpp">

  <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> fi(<span class="string">&quot;/tmp/archive.tar.gz&quot;</span>);
  <span class="type"><a href="qstring.html">QString</a></span> ext <span class="operator">=</span> fi<span class="operator">.</span>completeSuffix();  <span class="comment">// ext = &quot;tar.gz&quot;</span>

</pre>
<p><b>See also </b><a href="qfileinfo.html#fileName">fileName</a>(), <a href="qfileinfo.html#suffix">suffix</a>(), <a href="qfileinfo.html#baseName">baseName</a>(), and <a href="qfileinfo.html#completeBaseName">completeBaseName</a>().</p>
<!-- @@@completeSuffix -->
<!-- $$$dir[overload1]$$$dir -->
<h3 class="fn" id="dir"><a name="dir"></a><span class="type"><a href="qdir.html">QDir</a></span> QFileInfo::<span class="name">dir</span>() const</h3>
<p>Returns the path of the object's parent directory as a <a href="qdir.html">QDir</a> object.</p>
<p><b>Note:</b> The <a href="qdir.html">QDir</a> returned always corresponds to the object's parent directory, even if the <a href="qfileinfo.html">QFileInfo</a> represents a directory.</p>
<p>For each of the following, dir() returns the <a href="qdir.html">QDir</a> <code>&quot;~/examples/191697&quot;</code>.</p>
<pre class="cpp">

      <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> fileInfo1(<span class="string">&quot;~/examples/191697/.&quot;</span>);
      <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> fileInfo2(<span class="string">&quot;~/examples/191697/..&quot;</span>);
      <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> fileInfo3(<span class="string">&quot;~/examples/191697/main.cpp&quot;</span>);

</pre>
<p>For each of the following, dir() returns the <a href="qdir.html">QDir</a> <code>&quot;.&quot;</code>.</p>
<pre class="cpp">

      <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> fileInfo4(<span class="string">&quot;.&quot;</span>);
      <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> fileInfo5(<span class="string">&quot;..&quot;</span>);
      <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> fileInfo6(<span class="string">&quot;main.cpp&quot;</span>);

</pre>
<p><b>See also </b><a href="qfileinfo.html#absolutePath">absolutePath</a>(), <a href="qfileinfo.html#filePath">filePath</a>(), <a href="qfileinfo.html#fileName">fileName</a>(), <a href="qfileinfo.html#isRelative">isRelative</a>(), and <a href="qfileinfo.html#absoluteDir">absoluteDir</a>().</p>
<!-- @@@dir -->
<!-- $$$exists[overload1]$$$exists -->
<h3 class="fn" id="exists"><a name="exists"></a><span class="type">bool</span> QFileInfo::<span class="name">exists</span>() const</h3>
<p>Returns <code>true</code> if the file exists; otherwise returns <code>false</code>.</p>
<p><b>Note: </b>If the file is a symlink that points to a non-existing file, false is returned.</p><!-- @@@exists -->
<!-- $$$exists$$$existsconstQString& -->
<h3 class="fn" id="exists-1"><a name="exists-1"></a><code>[static] </code><span class="type">bool</span> QFileInfo::<span class="name">exists</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>file</i>)</h3>
<p>Returns <code>true</code> if the <i>file</i> exists; otherwise returns <code>false</code>.</p>
<p><b>Note: </b>If <i>file</i> is a symlink that points to a non-existing file, false is returned.</p><p><b>Note: </b>Using this function is faster than using <code>QFileInfo(file).exists()</code> for file system access.</p><p>This function was introduced in  Qt 5.2.</p>
<!-- @@@exists -->
<!-- $$$fileName[overload1]$$$fileName -->
<h3 class="fn" id="fileName"><a name="fileName"></a><span class="type"><a href="qstring.html">QString</a></span> QFileInfo::<span class="name">fileName</span>() const</h3>
<p>Returns the name of the file, excluding the path.</p>
<p>Example:</p>
<pre class="cpp">

  <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> fi(<span class="string">&quot;/tmp/archive.tar.gz&quot;</span>);
  <span class="type"><a href="qstring.html">QString</a></span> name <span class="operator">=</span> fi<span class="operator">.</span>fileName();                <span class="comment">// name = &quot;archive.tar.gz&quot;</span>

</pre>
<p>Note that, if this <a href="qfileinfo.html">QFileInfo</a> object is given a path ending in a slash, the name of the file is considered empty.</p>
<p><b>See also </b><a href="qfileinfo.html#isRelative">isRelative</a>(), <a href="qfileinfo.html#filePath">filePath</a>(), <a href="qfileinfo.html#baseName">baseName</a>(), and <a href="qfileinfo.html#suffix">suffix</a>().</p>
<!-- @@@fileName -->
<!-- $$$filePath[overload1]$$$filePath -->
<h3 class="fn" id="filePath"><a name="filePath"></a><span class="type"><a href="qstring.html">QString</a></span> QFileInfo::<span class="name">filePath</span>() const</h3>
<p>Returns the file name, including the path (which may be absolute or relative).</p>
<p><b>See also </b><a href="qfileinfo.html#absoluteFilePath">absoluteFilePath</a>(), <a href="qfileinfo.html#canonicalFilePath">canonicalFilePath</a>(), and <a href="qfileinfo.html#isRelative">isRelative</a>().</p>
<!-- @@@filePath -->
<!-- $$$fileTime[overload1]$$$fileTimeQFile::FileTime -->
<h3 class="fn" id="fileTime"><a name="fileTime"></a><span class="type"><a href="qdatetime.html">QDateTime</a></span> QFileInfo::<span class="name">fileTime</span>(<span class="type"><a href="qfiledevice.html#FileTime-enum">QFile::FileTime</a></span> <i>time</i>) const</h3>
<p>Returns the file time specified by <i>time</i>. If the time cannot be determined, an invalid date time is returned.</p>
<p>This function was introduced in  Qt 5.10.</p>
<p><b>See also </b><a href="qfiledevice.html#FileTime-enum">QFile::FileTime</a> and <a href="qdatetime.html#isValid">QDateTime::isValid</a>().</p>
<!-- @@@fileTime -->
<!-- $$$group[overload1]$$$group -->
<h3 class="fn" id="group"><a name="group"></a><span class="type"><a href="qstring.html">QString</a></span> QFileInfo::<span class="name">group</span>() const</h3>
<p>Returns the group of the file. On Windows, on systems where files do not have groups, or if an error occurs, an empty string is returned.</p>
<p>This function can be time consuming under Unix (in the order of milliseconds).</p>
<p><b>See also </b><a href="qfileinfo.html#groupId">groupId</a>(), <a href="qfileinfo.html#owner">owner</a>(), and <a href="qfileinfo.html#ownerId">ownerId</a>().</p>
<!-- @@@group -->
<!-- $$$groupId[overload1]$$$groupId -->
<h3 class="fn" id="groupId"><a name="groupId"></a><span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> QFileInfo::<span class="name">groupId</span>() const</h3>
<p>Returns the id of the group the file belongs to.</p>
<p>On Windows and on systems where files do not have groups this function always returns (uint) -2.</p>
<p><b>See also </b><a href="qfileinfo.html#group">group</a>(), <a href="qfileinfo.html#owner">owner</a>(), and <a href="qfileinfo.html#ownerId">ownerId</a>().</p>
<!-- @@@groupId -->
<!-- $$$isAbsolute[overload1]$$$isAbsolute -->
<h3 class="fn" id="isAbsolute"><a name="isAbsolute"></a><span class="type">bool</span> QFileInfo::<span class="name">isAbsolute</span>() const</h3>
<p>Returns <code>true</code> if the file path name is absolute, otherwise returns false if the path is relative.</p>
<p><b>See also </b><a href="qfileinfo.html#isRelative">isRelative</a>().</p>
<!-- @@@isAbsolute -->
<!-- $$$isBundle[overload1]$$$isBundle -->
<h3 class="fn" id="isBundle"><a name="isBundle"></a><span class="type">bool</span> QFileInfo::<span class="name">isBundle</span>() const</h3>
<p>Returns <code>true</code> if this object points to a bundle or to a symbolic link to a bundle on <a href="../qtdoc/internationalization.html#macos">macOS</a> and iOS; otherwise returns <code>false</code>.</p>
<p>This function was introduced in  Qt 4.3.</p>
<p><b>See also </b><a href="qfileinfo.html#isDir">isDir</a>(), <a href="qfileinfo.html#isSymLink">isSymLink</a>(), and <a href="qfileinfo.html#isFile">isFile</a>().</p>
<!-- @@@isBundle -->
<!-- $$$isDir[overload1]$$$isDir -->
<h3 class="fn" id="isDir"><a name="isDir"></a><span class="type">bool</span> QFileInfo::<span class="name">isDir</span>() const</h3>
<p>Returns <code>true</code> if this object points to a directory or to a symbolic link to a directory; otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qfileinfo.html#isFile">isFile</a>(), <a href="qfileinfo.html#isSymLink">isSymLink</a>(), and <a href="qfileinfo.html#isBundle">isBundle</a>().</p>
<!-- @@@isDir -->
<!-- $$$isExecutable[overload1]$$$isExecutable -->
<h3 class="fn" id="isExecutable"><a name="isExecutable"></a><span class="type">bool</span> QFileInfo::<span class="name">isExecutable</span>() const</h3>
<p>Returns <code>true</code> if the file is executable; otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qfileinfo.html#isReadable">isReadable</a>(), <a href="qfileinfo.html#isWritable">isWritable</a>(), and <a href="qfileinfo.html#permission">permission</a>().</p>
<!-- @@@isExecutable -->
<!-- $$$isFile[overload1]$$$isFile -->
<h3 class="fn" id="isFile"><a name="isFile"></a><span class="type">bool</span> QFileInfo::<span class="name">isFile</span>() const</h3>
<p>Returns <code>true</code> if this object points to a file or to a symbolic link to a file. Returns <code>false</code> if the object points to something which isn't a file, such as a directory.</p>
<p><b>See also </b><a href="qfileinfo.html#isDir">isDir</a>(), <a href="qfileinfo.html#isSymLink">isSymLink</a>(), and <a href="qfileinfo.html#isBundle">isBundle</a>().</p>
<!-- @@@isFile -->
<!-- $$$isHidden[overload1]$$$isHidden -->
<h3 class="fn" id="isHidden"><a name="isHidden"></a><span class="type">bool</span> QFileInfo::<span class="name">isHidden</span>() const</h3>
<p>Returns <code>true</code> if this is a `hidden' file; otherwise returns <code>false</code>.</p>
<p><b>Note:</b> This function returns <code>true</code> for the special entries &quot;.&quot; and &quot;..&quot; on Unix, even though <a href="qdir.html#entryList">QDir::entryList</a> threats them as shown.</p>
<!-- @@@isHidden -->
<!-- $$$isNativePath[overload1]$$$isNativePath -->
<h3 class="fn" id="isNativePath"><a name="isNativePath"></a><span class="type">bool</span> QFileInfo::<span class="name">isNativePath</span>() const</h3>
<p>Returns <code>true</code> if the file path can be used directly with native APIs. Returns <code>false</code> if the file is otherwise supported by a virtual file system inside Qt, such as <a href="resources.html">the Qt Resource System</a>.</p>
<p><b>Note:</b> Native paths may still require conversion of path separators and character encoding, depending on platform and input requirements of the native API.</p>
<p>This function was introduced in  Qt 5.0.</p>
<p><b>See also </b><a href="qdir.html#toNativeSeparators">QDir::toNativeSeparators</a>(), <a href="qfile.html#encodeName">QFile::encodeName</a>(), <a href="qfileinfo.html#filePath">filePath</a>(), <a href="qfileinfo.html#absoluteFilePath">absoluteFilePath</a>(), and <a href="qfileinfo.html#canonicalFilePath">canonicalFilePath</a>().</p>
<!-- @@@isNativePath -->
<!-- $$$isReadable[overload1]$$$isReadable -->
<h3 class="fn" id="isReadable"><a name="isReadable"></a><span class="type">bool</span> QFileInfo::<span class="name">isReadable</span>() const</h3>
<p>Returns <code>true</code> if the user can read the file; otherwise returns <code>false</code>.</p>
<p><b>Note: </b>If the <a href="qfileinfo.html#ntfs-permissions">NTFS permissions</a> check has not been enabled, the result on Windows will merely reflect whether the file exists.</p><p><b>See also </b><a href="qfileinfo.html#isWritable">isWritable</a>(), <a href="qfileinfo.html#isExecutable">isExecutable</a>(), and <a href="qfileinfo.html#permission">permission</a>().</p>
<!-- @@@isReadable -->
<!-- $$$isRelative[overload1]$$$isRelative -->
<h3 class="fn" id="isRelative"><a name="isRelative"></a><span class="type">bool</span> QFileInfo::<span class="name">isRelative</span>() const</h3>
<p>Returns <code>true</code> if the file path name is relative, otherwise returns false if the path is absolute (e.g&#x2e; under Unix a path is absolute if it begins with a &quot;/&quot;).</p>
<p><b>See also </b><a href="qfileinfo.html#isAbsolute">isAbsolute</a>().</p>
<!-- @@@isRelative -->
<!-- $$$isRoot[overload1]$$$isRoot -->
<h3 class="fn" id="isRoot"><a name="isRoot"></a><span class="type">bool</span> QFileInfo::<span class="name">isRoot</span>() const</h3>
<p>Returns <code>true</code> if the object points to a directory or to a symbolic link to a directory, and that directory is the root directory; otherwise returns <code>false</code>.</p>
<!-- @@@isRoot -->
<!-- $$$isSymLink[overload1]$$$isSymLink -->
<h3 class="fn" id="isSymLink"><a name="isSymLink"></a><span class="type">bool</span> QFileInfo::<span class="name">isSymLink</span>() const</h3>
<p>Returns <code>true</code> if this object points to a symbolic link; otherwise returns <code>false</code>.</p>
<p>Symbolic links exist on Unix (including <a href="../qtdoc/internationalization.html#macos">macOS</a> and iOS) and Windows and are typically created by the <code>ln -s</code> or <code>mklink</code> commands, respectively. Opening a symbolic link effectively opens the <a href="qfileinfo.html#symLinkTarget">link's target</a>.</p>
<p>In addition, true will be returned for shortcuts (<code>*.lnk</code> files) on Windows. Opening those will open the <code>.lnk</code> file itself.</p>
<p>Example:</p>
<pre class="cpp">

  <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> info(fileName);
  <span class="keyword">if</span> (info<span class="operator">.</span>isSymLink())
      fileName <span class="operator">=</span> info<span class="operator">.</span>symLinkTarget();

</pre>
<p><b>Note: </b>If the symlink points to a non existing file, <a href="qfileinfo.html#exists">exists</a>() returns false.</p><p><b>See also </b><a href="qfileinfo.html#isFile">isFile</a>(), <a href="qfileinfo.html#isDir">isDir</a>(), and <a href="qfileinfo.html#symLinkTarget">symLinkTarget</a>().</p>
<!-- @@@isSymLink -->
<!-- $$$isWritable[overload1]$$$isWritable -->
<h3 class="fn" id="isWritable"><a name="isWritable"></a><span class="type">bool</span> QFileInfo::<span class="name">isWritable</span>() const</h3>
<p>Returns <code>true</code> if the user can write to the file; otherwise returns <code>false</code>.</p>
<p><b>Note: </b>If the <a href="qfileinfo.html#ntfs-permissions">NTFS permissions</a> check has not been enabled, the result on Windows will merely reflect whether the file is marked as Read Only.</p><p><b>See also </b><a href="qfileinfo.html#isReadable">isReadable</a>(), <a href="qfileinfo.html#isExecutable">isExecutable</a>(), and <a href="qfileinfo.html#permission">permission</a>().</p>
<!-- @@@isWritable -->
<!-- $$$lastModified[overload1]$$$lastModified -->
<h3 class="fn" id="lastModified"><a name="lastModified"></a><span class="type"><a href="qdatetime.html">QDateTime</a></span> QFileInfo::<span class="name">lastModified</span>() const</h3>
<p>Returns the date and local time when the file was last modified.</p>
<p><b>See also </b><a href="qfileinfo.html#birthTime">birthTime</a>(), <a href="qfileinfo.html#lastRead">lastRead</a>(), <a href="qfileinfo.html#metadataChangeTime">metadataChangeTime</a>(), and <a href="qfileinfo.html#fileTime">fileTime</a>().</p>
<!-- @@@lastModified -->
<!-- $$$lastRead[overload1]$$$lastRead -->
<h3 class="fn" id="lastRead"><a name="lastRead"></a><span class="type"><a href="qdatetime.html">QDateTime</a></span> QFileInfo::<span class="name">lastRead</span>() const</h3>
<p>Returns the date and local time when the file was last read (accessed).</p>
<p>On platforms where this information is not available, returns the same as <a href="qfileinfo.html#lastModified">lastModified</a>().</p>
<p><b>See also </b><a href="qfileinfo.html#birthTime">birthTime</a>(), <a href="qfileinfo.html#lastModified">lastModified</a>(), <a href="qfileinfo.html#metadataChangeTime">metadataChangeTime</a>(), and <a href="qfileinfo.html#fileTime">fileTime</a>().</p>
<!-- @@@lastRead -->
<!-- $$$makeAbsolute[overload1]$$$makeAbsolute -->
<h3 class="fn" id="makeAbsolute"><a name="makeAbsolute"></a><span class="type">bool</span> QFileInfo::<span class="name">makeAbsolute</span>()</h3>
<p>Converts the file's path to an absolute path if it is not already in that form. Returns <code>true</code> to indicate that the path was converted; otherwise returns <code>false</code> to indicate that the path was already absolute.</p>
<p><b>See also </b><a href="qfileinfo.html#filePath">filePath</a>() and <a href="qfileinfo.html#isRelative">isRelative</a>().</p>
<!-- @@@makeAbsolute -->
<!-- $$$metadataChangeTime[overload1]$$$metadataChangeTime -->
<h3 class="fn" id="metadataChangeTime"><a name="metadataChangeTime"></a><span class="type"><a href="qdatetime.html">QDateTime</a></span> QFileInfo::<span class="name">metadataChangeTime</span>() const</h3>
<p>Returns the date and time when the file metadata was changed. A metadata change occurs when the file is created, but it also occurs whenever the user writes or sets inode information (for example, changing the file permissions).</p>
<p>This function was introduced in  Qt 5.10.</p>
<p><b>See also </b><a href="qfileinfo.html#lastModified">lastModified</a>() and <a href="qfileinfo.html#lastRead">lastRead</a>().</p>
<!-- @@@metadataChangeTime -->
<!-- $$$owner[overload1]$$$owner -->
<h3 class="fn" id="owner"><a name="owner"></a><span class="type"><a href="qstring.html">QString</a></span> QFileInfo::<span class="name">owner</span>() const</h3>
<p>Returns the owner of the file. On systems where files do not have owners, or if an error occurs, an empty string is returned.</p>
<p>This function can be time consuming under Unix (in the order of milliseconds). On Windows, it will return an empty string unless the <a href="qfileinfo.html#ntfs-permissions">NTFS permissions</a> check has been enabled.</p>
<p><b>See also </b><a href="qfileinfo.html#ownerId">ownerId</a>(), <a href="qfileinfo.html#group">group</a>(), and <a href="qfileinfo.html#groupId">groupId</a>().</p>
<!-- @@@owner -->
<!-- $$$ownerId[overload1]$$$ownerId -->
<h3 class="fn" id="ownerId"><a name="ownerId"></a><span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> QFileInfo::<span class="name">ownerId</span>() const</h3>
<p>Returns the id of the owner of the file.</p>
<p>On Windows and on systems where files do not have owners this function returns ((uint) -2).</p>
<p><b>See also </b><a href="qfileinfo.html#owner">owner</a>(), <a href="qfileinfo.html#group">group</a>(), and <a href="qfileinfo.html#groupId">groupId</a>().</p>
<!-- @@@ownerId -->
<!-- $$$path[overload1]$$$path -->
<h3 class="fn" id="path"><a name="path"></a><span class="type"><a href="qstring.html">QString</a></span> QFileInfo::<span class="name">path</span>() const</h3>
<p>Returns the file's path. This doesn't include the file name.</p>
<p>Note that, if this <a href="qfileinfo.html">QFileInfo</a> object is given a path ending in a slash, the name of the file is considered empty and this function will return the entire path.</p>
<p><b>See also </b><a href="qfileinfo.html#filePath">filePath</a>(), <a href="qfileinfo.html#absolutePath">absolutePath</a>(), <a href="qfileinfo.html#canonicalPath">canonicalPath</a>(), <a href="qfileinfo.html#dir">dir</a>(), <a href="qfileinfo.html#fileName">fileName</a>(), and <a href="qfileinfo.html#isRelative">isRelative</a>().</p>
<!-- @@@path -->
<!-- $$$permission[overload1]$$$permissionQFile::Permissions -->
<h3 class="fn" id="permission"><a name="permission"></a><span class="type">bool</span> QFileInfo::<span class="name">permission</span>(<span class="type"><a href="qfiledevice.html#Permission-enum">QFile::Permissions</a></span> <i>permissions</i>) const</h3>
<p>Tests for file permissions. The <i>permissions</i> argument can be several flags of type <a href="qfiledevice.html#Permission-enum">QFile::Permissions</a> OR-ed together to check for permission combinations.</p>
<p>On systems where files do not have permissions this function always returns <code>true</code>.</p>
<p><b>Note: </b>The result might be inaccurate on Windows if the <a href="qfileinfo.html#ntfs-permissions">NTFS permissions</a> check has not been enabled.</p><p>Example:</p>
<pre class="cpp">

  <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> fi(<span class="string">&quot;/tmp/archive.tar.gz&quot;</span>);
  <span class="keyword">if</span> (fi<span class="operator">.</span>permission(<span class="type"><a href="qfile.html">QFile</a></span><span class="operator">::</span>WriteUser <span class="operator">|</span> <span class="type"><a href="qfile.html">QFile</a></span><span class="operator">::</span>ReadGroup))
      <a href="qtglobal.html#qWarning">qWarning</a>(<span class="string">&quot;I can change the file; my group can read the file&quot;</span>);
  <span class="keyword">if</span> (fi<span class="operator">.</span>permission(<span class="type"><a href="qfile.html">QFile</a></span><span class="operator">::</span>WriteGroup <span class="operator">|</span> <span class="type"><a href="qfile.html">QFile</a></span><span class="operator">::</span>WriteOther))
      <a href="qtglobal.html#qWarning">qWarning</a>(<span class="string">&quot;The group or others can change the file&quot;</span>);

</pre>
<p><b>See also </b><a href="qfileinfo.html#isReadable">isReadable</a>(), <a href="qfileinfo.html#isWritable">isWritable</a>(), and <a href="qfileinfo.html#isExecutable">isExecutable</a>().</p>
<!-- @@@permission -->
<!-- $$$permissions[overload1]$$$permissions -->
<h3 class="fn" id="permissions"><a name="permissions"></a><span class="type"><a href="qfiledevice.html#Permission-enum">QFile::Permissions</a></span> QFileInfo::<span class="name">permissions</span>() const</h3>
<p>Returns the complete OR-ed together combination of <a href="qfiledevice.html#Permission-enum">QFile::Permissions</a> for the file.</p>
<p><b>Note: </b>The result might be inaccurate on Windows if the <a href="qfileinfo.html#ntfs-permissions">NTFS permissions</a> check has not been enabled.</p><!-- @@@permissions -->
<!-- $$$refresh[overload1]$$$refresh -->
<h3 class="fn" id="refresh"><a name="refresh"></a><span class="type">void</span> QFileInfo::<span class="name">refresh</span>()</h3>
<p>Refreshes the information about the file, i.e&#x2e; reads in information from the file system the next time a cached property is fetched.</p>
<!-- @@@refresh -->
<!-- $$$setCaching[overload1]$$$setCachingbool -->
<h3 class="fn" id="setCaching"><a name="setCaching"></a><span class="type">void</span> QFileInfo::<span class="name">setCaching</span>(<span class="type">bool</span> <i>enable</i>)</h3>
<p>If <i>enable</i> is true, enables caching of file information. If <i>enable</i> is false caching is disabled.</p>
<p>When caching is enabled, <a href="qfileinfo.html">QFileInfo</a> reads the file information from the file system the first time it's needed, but generally not later.</p>
<p>Caching is enabled by default.</p>
<p><b>See also </b><a href="qfileinfo.html#refresh">refresh</a>() and <a href="qfileinfo.html#caching">caching</a>().</p>
<!-- @@@setCaching -->
<!-- $$$setFile[overload1]$$$setFileconstQString& -->
<h3 class="fn" id="setFile"><a name="setFile"></a><span class="type">void</span> QFileInfo::<span class="name">setFile</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>file</i>)</h3>
<p>Sets the file that the <a href="qfileinfo.html">QFileInfo</a> provides information about to <i>file</i>.</p>
<p>The <i>file</i> can also include an absolute or relative file path. Absolute paths begin with the directory separator (e.g&#x2e; &quot;/&quot; under Unix) or a drive specification (under Windows). Relative file names begin with a directory name or a file name and specify a path relative to the current directory.</p>
<p>Example:</p>
<pre class="cpp">

  <span class="type"><a href="qstring.html">QString</a></span> absolute <span class="operator">=</span> <span class="string">&quot;/local/bin&quot;</span>;
  <span class="type"><a href="qstring.html">QString</a></span> relative <span class="operator">=</span> <span class="string">&quot;local/bin&quot;</span>;
  <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> absFile(absolute);
  <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> relFile(relative);

  <span class="type"><a href="qdir.html">QDir</a></span><span class="operator">::</span>setCurrent(<span class="type"><a href="qdir.html">QDir</a></span><span class="operator">::</span>rootPath());
  <span class="comment">// absFile and relFile now point to the same file</span>

  <span class="type"><a href="qdir.html">QDir</a></span><span class="operator">::</span>setCurrent(<span class="string">&quot;/tmp&quot;</span>);
  <span class="comment">// absFile now points to &quot;/local/bin&quot;,</span>
  <span class="comment">// while relFile points to &quot;/tmp/local/bin&quot;</span>

</pre>
<p><b>See also </b><a href="qfileinfo.html#isFile">isFile</a>(), <a href="qfileinfo.html#isRelative">isRelative</a>(), <a href="qdir.html#setCurrent">QDir::setCurrent</a>(), and <a href="qdir.html#isRelativePath">QDir::isRelativePath</a>().</p>
<!-- @@@setFile -->
<!-- $$$setFile$$$setFileconstQFile& -->
<h3 class="fn" id="setFile-1"><a name="setFile-1"></a><span class="type">void</span> QFileInfo::<span class="name">setFile</span>(const <span class="type"><a href="qfile.html">QFile</a></span> &amp;<i>file</i>)</h3>
<p>This is an overloaded function.</p>
<p>Sets the file that the <a href="qfileinfo.html">QFileInfo</a> provides information about to <i>file</i>.</p>
<p>If <i>file</i> includes a relative path, the <a href="qfileinfo.html">QFileInfo</a> will also have a relative path.</p>
<p><b>See also </b><a href="qfileinfo.html#isRelative">isRelative</a>().</p>
<!-- @@@setFile -->
<!-- $$$setFile$$$setFileconstQDir&constQString& -->
<h3 class="fn" id="setFile-2"><a name="setFile-2"></a><span class="type">void</span> QFileInfo::<span class="name">setFile</span>(const <span class="type"><a href="qdir.html">QDir</a></span> &amp;<i>dir</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>file</i>)</h3>
<p>This is an overloaded function.</p>
<p>Sets the file that the <a href="qfileinfo.html">QFileInfo</a> provides information about to <i>file</i> in directory <i>dir</i>.</p>
<p>If <i>file</i> includes a relative path, the <a href="qfileinfo.html">QFileInfo</a> will also have a relative path.</p>
<p><b>See also </b><a href="qfileinfo.html#isRelative">isRelative</a>().</p>
<!-- @@@setFile -->
<!-- $$$size[overload1]$$$size -->
<h3 class="fn" id="size"><a name="size"></a><span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> QFileInfo::<span class="name">size</span>() const</h3>
<p>Returns the file size in bytes. If the file does not exist or cannot be fetched, 0 is returned.</p>
<p><b>See also </b><a href="qfileinfo.html#exists">exists</a>().</p>
<!-- @@@size -->
<!-- $$$suffix[overload1]$$$suffix -->
<h3 class="fn" id="suffix"><a name="suffix"></a><span class="type"><a href="qstring.html">QString</a></span> QFileInfo::<span class="name">suffix</span>() const</h3>
<p>Returns the suffix (extension) of the file.</p>
<p>The suffix consists of all characters in the file after (but not including) the last '.'&#x2e;</p>
<p>Example:</p>
<pre class="cpp">

  <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> fi(<span class="string">&quot;/tmp/archive.tar.gz&quot;</span>);
  <span class="type"><a href="qstring.html">QString</a></span> ext <span class="operator">=</span> fi<span class="operator">.</span>suffix();  <span class="comment">// ext = &quot;gz&quot;</span>

</pre>
<p>The suffix of a file is computed equally on all platforms, independent of file naming conventions (e.g&#x2e;, &quot;.bashrc&quot; on Unix has an empty base name, and the suffix is &quot;bashrc&quot;).</p>
<p><b>See also </b><a href="qfileinfo.html#fileName">fileName</a>(), <a href="qfileinfo.html#completeSuffix">completeSuffix</a>(), <a href="qfileinfo.html#baseName">baseName</a>(), and <a href="qfileinfo.html#completeBaseName">completeBaseName</a>().</p>
<!-- @@@suffix -->
<!-- $$$swap[overload1]$$$swapQFileInfo& -->
<h3 class="fn" id="swap"><a name="swap"></a><span class="type">void</span> QFileInfo::<span class="name">swap</span>(<span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> &amp;<i>other</i>)</h3>
<p>Swaps this file info with <i>other</i>. This function is very fast and never fails.</p>
<p>This function was introduced in  Qt 5.0.</p>
<!-- @@@swap -->
<!-- $$$symLinkTarget[overload1]$$$symLinkTarget -->
<h3 class="fn" id="symLinkTarget"><a name="symLinkTarget"></a><span class="type"><a href="qstring.html">QString</a></span> QFileInfo::<span class="name">symLinkTarget</span>() const</h3>
<p>Returns the absolute path to the file or directory a symbolic link points to, or an empty string if the object isn't a symbolic link.</p>
<p>This name may not represent an existing file; it is only a string. <a href="qfileinfo.html#exists">QFileInfo::exists</a>() returns <code>true</code> if the symlink points to an existing file.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qfileinfo.html#exists">exists</a>(), <a href="qfileinfo.html#isSymLink">isSymLink</a>(), <a href="qfileinfo.html#isDir">isDir</a>(), and <a href="qfileinfo.html#isFile">isFile</a>().</p>
<!-- @@@symLinkTarget -->
<!-- $$$operator!=[overload1]$$$operator!=constQFileInfo& -->
<h3 class="fn" id="operator-not-eq"><a name="operator-not-eq"></a><span class="type">bool</span> QFileInfo::<span class="name">operator!=</span>(const <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> &amp;<i>fileinfo</i>) const</h3>
<p>Returns <code>true</code> if this <a href="qfileinfo.html">QFileInfo</a> object refers to a different file than the one specified by <i>fileinfo</i>; otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qfileinfo.html#operator-eq-eq">operator==</a>().</p>
<!-- @@@operator!= -->
<!-- $$$operator=[overload1]$$$operator=constQFileInfo& -->
<h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> &amp;QFileInfo::<span class="name">operator=</span>(const <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> &amp;<i>fileinfo</i>)</h3>
<p>Makes a copy of the given <i>fileinfo</i> and assigns it to this <a href="qfileinfo.html">QFileInfo</a>.</p>
<!-- @@@operator= -->
<!-- $$$operator=$$$operator=QFileInfo&& -->
<h3 class="fn" id="operator-eq-1"><a name="operator-eq-1"></a><span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> &amp;QFileInfo::<span class="name">operator=</span>(<span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> &amp;&amp;<i>other</i>)</h3>
<p>Move-assigns <i>other</i> to this <a href="qfileinfo.html">QFileInfo</a> instance.</p>
<p>This function was introduced in  Qt 5.2.</p>
<!-- @@@operator= -->
<!-- $$$operator==[overload1]$$$operator==constQFileInfo& -->
<h3 class="fn" id="operator-eq-eq"><a name="operator-eq-eq"></a><span class="type">bool</span> QFileInfo::<span class="name">operator==</span>(const <span class="type"><a href="qfileinfo.html#QFileInfo">QFileInfo</a></span> &amp;<i>fileinfo</i>) const</h3>
<p>Returns <code>true</code> if this <a href="qfileinfo.html">QFileInfo</a> object refers to a file in the same location as <i>fileinfo</i>; otherwise returns <code>false</code>.</p>
<p>Note that the result of comparing two empty <a href="qfileinfo.html">QFileInfo</a> objects, containing no file references (file paths that do not exist or are empty), is undefined.</p>
<p><b>Warning:</b> This will not compare two different symbolic links pointing to the same file.</p>
<p><b>Warning:</b> Long and short file names that refer to the same file on Windows are treated as if they referred to different files.</p>
<p><b>See also </b><a href="qfileinfo.html#operator-not-eq">operator!=</a>().</p>
<!-- @@@operator== -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$QFileInfoList -->
<h3 class="fn" id="QFileInfoList-typedef"><a name="QFileInfoList-typedef"></a>typedef <span class="name">QFileInfoList</span></h3>
<p>Synonym for <a href="qlist.html">QList</a>&lt;<a href="qfileinfo.html">QFileInfo</a>&gt;.</p>
<!-- @@@QFileInfoList -->
</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>