Nested TableView

  • Hello,

    I would like to created a nested TableView for some elements of my main TableView.
    alt text

    For example, if Rowtitle == ""Brilliance" , I would like to created a subTableView for this row.

    ListModel {
        id: libraryModel
        ListElement {
            title: "A Masterpiece"
            author: "Gabriel"
        ListElement {
            title: "Brilliance"
            author: "Jens"
        ListElement {
            title: "Outstanding"
            author: "Frederik"
    TableView {
        TableViewColumn {
            role: "title"
            title: "Title"
            width: 100
           //if title==""Brilliance" create a second tableview
        TableViewColumn {
            role: "author"
            title: "Author"
            width: 200
        model: libraryModel

    Do you have any idea how to do it ?

    Thanks a lot !

  • How about using TreeView? You can also use Loader as delegate if you need customization.
    b.t.w treeView is quite buggy and for some reason is being ignored by Qt bug fixers. If this stops you of using TreeView, so far I know TableView has similar bugs.

  • Hello, thanks for your answer.
    I am thinking of using TreeView but my code might change a lot and I just need for some elements to have a nested list of one level so I wanted to know if there was a simple way to do it.

    This how my data should be most of the time:


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.