0

What should I use, QTableWidget oder QTableView?

I'm currently working on a program to display some log files in a Table. I was using QTableWidget until now, but I want to implement some filtering options.

When searching the Internet for an answer I couldn't find out, what the difference between the two are, except that QTableView looks way more complicated. The log files that I'm displaying all have about 25 thousand rows. I have already written code where I can right-click on cells to add them to a "filterKeyword" List. I want to filter out all rows, that dont contain a keyword from the list (Doesnt matter in what column the keyword is).

Obviously the best would be, if there was a way to do this with QTableWidget, since I already have other Functions based on it.

vberiah
  • 13
  • 1
  • 4
  • `QTableWidget` is just a convenience class with a built-in custom model. It is a subclass of `QTableView`, so they are effectively the same thing. `QTableView` is much more flexible and can easily be adapted to your own needs. Once you understand the basics, it is no more complicated than using `QTableWidget`, since most of the API is exactly the same. – ekhumoro Aug 08 '19 at 11:24

1 Answers1

0

I think you should look at a this discussion about filter. if I understand your problem, a possibility to filter is to loop through the entire table and hide all the items that do not reflect the search criteria. Look at the link for an example. If you want a better solution instead use QTableView

user1746397
  • 48
  • 1
  • 7