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

Subarray in array

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 1.6k Views
  • 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.
  • Z Offline
    Z Offline
    Zoptune
    wrote on 26 Jul 2016, 08:52 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
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 26 Jul 2016, 08:57 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.

      Z 1 Reply Last reply 26 Jul 2016, 09:27
      3
      • M mrjj
        26 Jul 2016, 08:57

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

        Except you want for another col.

        Z Offline
        Z Offline
        Zoptune
        wrote on 26 Jul 2016, 09:27 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
        • Z Offline
          Z Offline
          Zoptune
          wrote on 27 Jul 2016, 08:54 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
          • V Offline
            V Offline
            VRonin
            wrote on 27 Jul 2016, 10:58 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
            • Z Offline
              Z Offline
              Zoptune
              wrote on 28 Jul 2016, 10:23 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

              1/6

              26 Jul 2016, 08:52

              • Login

              • Login or register to search.
              1 out of 6
              • First post
                1/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved