Subarray in array



  • Hi,

    I have a QTableView which displays the content of a database.
    There is information like product reference, quantity, ...

    Is it possible, when the user click on a row, to display a detailed subarray.

    I want something like this :

    alt text

    I currently display two QTableview but it's not really ergonomic.

    Thanks :)


  • Qt Champions 2016

    Hi
    It sort of remind me of
    http://doc.qt.io/qt-5/qtwidgets-itemviews-editabletreemodel-example.html

    Except you want for another col.



  • @mrjj Hi and thanks for your answer :)

    It seems to be what i want, i will try and post a feedback.



  • So, i decided to use QtreeWidget and QTableWidget as a QTreeWidgetItem.

    alt text

    I have changed the stylesheet to add bottom border but i want the stylesheet to apply only on the rootItem.

    Is it possible ?

    Thx



  • It might not be 100% what you want but KSelectionProxyModel from KDE API might be a good compromise



  • I looked at the KSelectionProxyModel but it seemed a bit hard for me ^^

    I choose an other solution :
    Because my tree widget is a two-level hierarchy, i can identify my top-level items because they have child.

    So i applied a stylesheet :

    QString style = "QTreeWidget::item "
            "{ "
             "margin-bottom: 10px;"
            "}"
            "QTreeWidget::item:has-children "  // Apply only on my top-level item
                "{"
                "border-top: 1px solid black;"
                        "background-color: lightGray"
                "}";
    

Log in to reply
 

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