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. [Solved] Making filter in QTableWidget
Forum Updated to NodeBB v4.3 + New Features

[Solved] Making filter in QTableWidget

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 7.8k 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.
  • M Offline
    M Offline
    mafiozzi
    wrote on last edited by
    #1

    Good day, everyone.
    Tell me please, is there a way to make a filter in a QTableWidget? I know that I can use a QTreeView and QSortFilterProxyModel (i saw it in examples), but what about a QTableWidget.

    Thank you all!

    You have exactly five minutes to win
    Or a lifetime to forget if you don't

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      QTableView is your better choice. By filtering you want to influence your data. That is what the model-view approach does : you need to work on your model.

      If you want to stick with QTableWidget you need to
      write a filter function yourself and use findItems() to get all the matching items in the table. Iterate the results to hide the filtered rows...

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mafiozzi
        wrote on last edited by
        #3

        Thank you very much, Eddy! Im a newcomer in Qt, So I want to be sure that Im not miss something important. Thank you!

        You have exactly five minutes to win
        Or a lifetime to forget if you don't

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          You're welcome.

          Please add [Solved] in front of your title.
          That way others know this is solved.

          Qt Certified Specialist
          www.edalsolutions.be

          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