Note that there are some explanatory texts on larger screens.

plurals
  1. POHide those folders don't have filtered Files
    text
    copied!<p>I am working on QTreeviews, One has all the drives in it. and the other one displays all the files and folders corresponding to those drives. I have applied filters for some particular files. So it shows all those folders which have those particular filters formats as well as those folders which don't have filtered files as a empty folders. Now my problem is that i don't want to show those folders which don't have my filtered files. I am using this:</p> <pre><code>QFileSystemModel *fileSystemModel = new QFileSystemModel(this); fileSystemModel-&gt;setRootPath(path); QStringList filters; filters &lt;&lt;"*.jpeg" &lt;&lt;"*.pict" &lt;&lt;"*.PICT" &lt;&lt;"*.xpm" &lt;&lt;"*.xbm" &lt;&lt;"*.ppm" &lt;&lt;"*.pbm" &lt;&lt;"*.pgm" &lt;&lt;"*.XBM" &lt;&lt;"*.XPM" &lt;&lt;"*.PPM" &lt;&lt;"*.PBM" &lt;&lt;"*.PGM" &lt;&lt;"*.png" &lt;&lt;"*.psd" &lt;&lt;"*.bmp"&lt;&lt;"*.jp2" &lt;&lt;"*.tiff" &lt;&lt;"*.gif" &lt;&lt;"*.tga" &lt;&lt;"*.jpg" &lt;&lt;"*.JPG" &lt;&lt;"*.JPEG" &lt;&lt;"*.BMP" &lt;&lt;"*.JP2"&lt;&lt;"*.PSD" &lt;&lt;"*.PNG" &lt;&lt;"*.TIFF" &lt;&lt;"*.GIF" &lt;&lt;"*.TGA" ; fileSystemModel-&gt;setNameFilters(filters); fileSystemModel-&gt;setNameFilterDisables(0); fileSystemModel-&gt;setSupportedDragActions(Qt::CopyAction); fileSystemModel-&gt;fetchMore(fileSystemModel-&gt;index(path)); ui-&gt;treeView_2-&gt;setModel(fileSystemModel); ui-&gt;treeView_2-&gt;setRootIndex(fileSystemModel-&gt;index(path)); ui-&gt;treeView_2-&gt;setColumnWidth(0,300); </code></pre> <p>Can anyone please help me out of it. Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload