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. Subarray in array
Qt 6.11 is out! See what's new in the release blog

Subarray in array

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 1.7k 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.
  • ZoptuneZ Offline
    ZoptuneZ Offline
    Zoptune
    wrote on last edited by
    #1

    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 :)

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

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

      Except you want for another col.

      ZoptuneZ 1 Reply Last reply
      3
      • mrjjM mrjj

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

        Except you want for another col.

        ZoptuneZ Offline
        ZoptuneZ Offline
        Zoptune
        wrote on last edited by
        #3

        @mrjj Hi and thanks for your answer :)

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

        1 Reply Last reply
        0
        • ZoptuneZ Offline
          ZoptuneZ Offline
          Zoptune
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by
            #5

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

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            1 Reply Last reply
            2
            • ZoptuneZ Offline
              ZoptuneZ Offline
              Zoptune
              wrote on last edited by
              #6

              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"
                          "}";
              
              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