Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. qfilesystemmode
    Log in to post

    • UNSOLVED segv when getting QFileInfo from subclassed QFileSystemModel
      General and Desktop • qtableview qabstractitemmo qfilesystemmode qmodelindex qt5.13.1 • • CybeX  

      2
      0
      Votes
      2
      Posts
      141
      Views

      What's the benefit of FileSystemModel::getFileInfo()? I would guess your this pointer is a nullptr
    • UNSOLVED Best approach to create "virtual QFileSystemModel"?
      General and Desktop • qfilesystemmode • • notsofast  

      4
      0
      Votes
      4
      Posts
      144
      Views

      @JonB said in Best approach to create "virtual QFileSystemModel"?: Quite possibly. Though QFileSystemModel itself is sub-classsable alternatively. I don't see how subclassing QFileSystemModel will let me insert virtual nodes at the top of the tree and have other QFileSystemModels as branches lower in the tree. Thanks for the pointer to the example. I'll study it some more, but so far it's still eluding me how to manage the top of the tree but delegate things back to the QFileSystemModels lower in the tree. I'm trying to create a VirtualFileSystemNode that can hold a pathname or a QFileSystem model as its data, but no success yet.
    • UNSOLVED File Browser with context menu to unzip files
      General and Desktop • qtreeview qfiledialog qfilesystemmode • • mahesh_j  

      7
      0
      Votes
      7
      Posts
      579
      Views

      @mahesh_j said in File Browser with context menu to unzip files: But I don't know what actions to add to the QMenu The actions you need. You have to create such a pop-up menu. Take a look at http://quazip.sourceforge.net/
    • UNSOLVED QFileSystemModel and QSortFilterProxyModel - root index is not preserved
      General and Desktop • c++ qsortfilterprox qfilesystemmode filtering • • MasterBLB  

      22
      0
      Votes
      22
      Posts
      1806
      Views

      breaks SOLID It doesn't. In fact, if it worked as you expected it would break SOLID it's definitely a serious design flaw Sorry to be brutal: No, it's not a flaw, you just didn't understand the design of model/views. To help you get a better idea of what is going on, try use the same model with 2 different treeviews. In only one of the view call setRootIndex, and then trigger the filtering.
    • SOLVED Reimplementing QFileSystemModel Checkboxes using QMap inconsistent results
      General and Desktop • qtreeview qabstractitemmo qsortfilterprox qfilesystemmode • • moffa13  

      15
      0
      Votes
      15
      Posts
      1510
      Views

      Ok I found what was causing this awful bug. When I check if the map contains the index, I actually check the raw index not the QPersistantModelIndex so this is not the same object and I think qmap does not check equality using == operator . So I have to iterate over the map and check using QPersistantModelIndex "==" operators which can compare from a QModelIndex.
    • UNSOLVED Add new row in QTreeView (Using QFileSystemModel to populate TreeView and QSortFilterProxy model to filter folder)
      General and Desktop • qtreeview qt5.6 qsortfilterprox qfilesystemmode row • • Punit  

      2
      0
      Votes
      2
      Posts
      1666
      Views

      Hi, Apply the same filter you are using for your single folder version except that this time rather than using a QString you should keep a QStringList of the folders you want to show and use that.
    • UNSOLVED Delete a selected folder and all sub folders in QTreeView
      General and Desktop • qtreeview qt5.6 delete qfilesystemmode removerow • • Punit  

      4
      0
      Votes
      4
      Posts
      1826
      Views

      That wasn't really clear from your original description. In that case, use a filter. QSortFilterProxyModel for example
    • SOLVED QTreeView shows all the subfolders, but not the parent folder.
      General and Desktop • treeview qt 5.6 qfilesystemmode directory root • • Punit  

      7
      0
      Votes
      7
      Posts
      4117
      Views

      I had issues making these solutions work for the QML TreeView. I ended up setting the root path of my QFileSystemModel to the directory I wanted to view. Then I set the rootIndex in the TreeView to the parent of the index for that directory. This is of course showed its siblings. Then I did the following to filter those siblings away. I also made this optional through a property as there are times when I want that behavior: bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { FileSystemModel* tmodel = qobject_cast<FileSystemModel*>(parent()); if(tmodel){ QModelIndex index = tmodel->index(source_row, 0, source_parent); QModelIndex rootIndex = tmodel->index(tmodel->rootPath()); if(!rootIndex.isValid() || !index.isValid()) return false; return ((index == rootIndex) || !(tmodel->filtersiblings() && isSiblingOf(index, rootIndex))); } return false; } bool isSiblingOf(const QModelIndex& index, const QModelIndex& parent) const { if(!index.isValid() || !parent.isValid()) return false; QModelIndex sibling; int row=0; do{ sibling = parent.sibling(row,0); if(sibling == index) return true; ++row; }while(sibling.isValid()); return false; } I took more of a blacklist approach versus a whitelist approach.
    • SOLVED Drag&Drop using QFileSystemModel.
      General and Desktop • qtableview drag and drop qfilesystemmode qabstractitemvi • • tokafr  

      4
      0
      Votes
      4
      Posts
      1649
      Views

      @tokafr Super. so it can copy files on its own ? Doc hinted it, but I was not sure.
    • UNSOLVED Remove non empty directory with QFileSystemModel.
      General and Desktop • qfilesystemmode qdir • • tokafr  

      4
      0
      Votes
      4
      Posts
      2055
      Views

      @tokafr Oh. That would have been too easy then :) http://stackoverflow.com/questions/11050977/removing-a-non-empty-folder-in-qt has a function that looks good. bool removeDir(const QString & dirName) make sure to give it full path. I dont think QFileSystemModel can do it directly . Not that i have seen.
    • UNSOLVED QFileSystemModel: include files from subfolders (Qt 5.5.1)
      General and Desktop • qt 5.5.1 qfilesystemmode subdirs • • qDebug  

      15
      0
      Votes
      15
      Posts
      5594
      Views

      That I understood. That's why I think that QDirIterator is a better tool to find what you want on your drive.
    • UNSOLVED [SOLVED] QTreeview Double Clicked "The program unexpectedly finished"
      General and Desktop • qtreeview qfilesystemmode doubleclick • • takoo  

      23
      0
      Votes
      23
      Posts
      9173
      Views

      Thanks everybody
    • [SOLVED] How to see if file is selected in list view with QFileSystemModel
      General and Desktop • qtreeview qlistview qfilesystemmode • • mar0029  

      14
      0
      Votes
      14
      Posts
      6758
      Views

      You're welcome ! By the way, now you can use the "Topic Tool" button to mark the thread as solved, it keeps the things cleaner :)
    • How can I get QFileSystemModel to display directories beginning with a "." (dotfiles) e.g. /users/paulsmith/.dirName?
      General and Desktop • qfilesystemmode qdir dotfiles • • gshannon154  

      5
      0
      Votes
      5
      Posts
      1300
      Views

      Brilliant thanks!
    • How to extend QFileSystemModel (inheritance)
      General and Desktop • qfilesystemmode inheritance • • Vandi  

      9
      0
      Votes
      9
      Posts
      2921
      Views

      @Chris-Kawa I am building from within Qt Creator (Windows 7), my .pro file didn't contain that! it just had: QT += gui Thank you Chris.