Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFileSystemModel should support QRegExp Filter
QtWS25 Last Chance

QFileSystemModel should support QRegExp Filter

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 3.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RobotR
    wrote on last edited by
    #1

    Not only Wildcard, but also RegExp.
    I have found it hard to hide the backup files whose name is like "~anyfile.txt","#anyfile.txt" and etc.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      Have you tried using a QSortFilterProxyModel? As the name implies it is the recommended way to sort and filter other models before they are displayed in a view.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        RobotR
        wrote on last edited by
        #3

        I haven't used QSortFilterProxyModel before. Let me try it.

        Thank you very much!

        1 Reply Last reply
        0
        • R Offline
          R Offline
          RobotR
          wrote on last edited by
          #4

          It is very convenient to use QSortFilterProxyModel.

          But new problem emerged...

          QFileSystemModel::index() will generate modelIndex which haven't created yet. QSortFilterProxyModel do not know the new created modelIndex node. So when I try to use :

          @QModelIndex index = _proxyModel->mapFromSource(_mode->index(strDirPath));

          myView->scrollTo(index, QAbstractItemView::PositionAtCenter);@

          It is crashed in "scrollTo". index is valid ,but parent of index is not valid.

          1 Reply Last reply
          0
          • R Offline
            R Offline
            RobotR
            wrote on last edited by
            #5

            I have found way to solve this problem:

            reset the relationship of proxymodel and sourcemodel

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved