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. Filter vector of strings
Qt 6.11 is out! See what's new in the release blog

Filter vector of strings

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 620 Views 1 Watching
  • 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.
  • A Offline
    A Offline
    AlexandruToma
    wrote on last edited by
    #1

    Hello,

    I have a table view with a vector<vector<string>> as underlaying data. Every string is a unique object. I would like to print in table only objects that contains specific pattern inserted in ui, like person name. I saw basicsortfiltermodel example, but didnt'show a costum implementation of this method proxyModel->setFilterRegularExpression(regularExpression), and I don't know to write one. Can someone give me an advice, please.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      But do you need/want to filter by a regular expression ?

      If you have custom logic , you could just override
      https://doc.qt.io/qt-5/qsortfilterproxymodel.html#filterAcceptsRow
      and apply the logic there.

      else im not sure what you mean by a

      " but didnt'show a costum implementation of this method proxyModel->setFilterRegularExpression "

      as it simply accepts a regular expression.
      https://regexr.com/

      1 Reply Last reply
      3

      • Login

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