Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Make QTableView rows expandable and collapsable



  • Hi, I'm using QTableView to display alerts in a monitoring application. I would to add the following feature to the table:

    For each row there'll be a field, that once it's clicked it'll collapse all the alerts with the same subject (same value in a certain field) and instead display a single row. For that single row there'll be a field that once it's clikced, all the collapsed rows will be expanded again.

    I need this feature to enable the users to control the number of rows they see and control....

    How can it be done?

    Thanks.



  • Hi,

    You should use QTreeView instead of QTableView.

    Regards,



  • If it should look like a tree, use QTreeWidget.
    Otherwise use a Filter Proxy model and implement some stuff for that (e.g. a checkable item which means

    checked = filtered



  • Note that you can adapt how a tree looks, so even if it functions like one, it doesn't need to look like one.


Log in to reply