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. Displaying Widget Below QTableView Row
Forum Updated to NodeBB v4.3 + New Features

Displaying Widget Below QTableView Row

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 637 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.
  • Q Offline
    Q Offline
    Qt_User72653
    wrote on last edited by
    #1

    Right now I have a simple table displaying data, but a requirement is that the user can click on a table row and a widget will be displayed below the row with a chart of supplementary information that can be interacted with.

    I've used delegates before to paint cells and rows with custom styles, but I've never had a row that was expanded to show another widget. Is it possible to create a delegate that is painted like a normal row but also has an embedded widget that deals with it's own input and paint events?

    My idea is to set the size hint for the selected row and have it expand, then set a delegate on it that will display the supplementary information widget.

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

      Hi
      If you don't override paint for you delegate the cells will draw as normal.
      Then in CreatorEditor, you can create any widget you wish even complex ones.
      But as soon as user click on another cell the Editor widget is deleted and you must then set row size to normal.
      So im not sure how good it will work, but its worth a shot.

      Is there only one column, or do you want the user to click any col on a row and it
      pretends its one row showing the cart along the full width?

      Im asking as delegates are cell orientated and will clip to cells area pr default so spanning
      multiple might be more involving.

      How many rows will you have ?

      Q 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi
        If you don't override paint for you delegate the cells will draw as normal.
        Then in CreatorEditor, you can create any widget you wish even complex ones.
        But as soon as user click on another cell the Editor widget is deleted and you must then set row size to normal.
        So im not sure how good it will work, but its worth a shot.

        Is there only one column, or do you want the user to click any col on a row and it
        pretends its one row showing the cart along the full width?

        Im asking as delegates are cell orientated and will clip to cells area pr default so spanning
        multiple might be more involving.

        How many rows will you have ?

        Q Offline
        Q Offline
        Qt_User72653
        wrote on last edited by
        #3

        @mrjj

        @mrjj said in Displaying Widget Below QTableView Row:

        Is there only one column, or do you want the user to click any col on a row and it
        pretends its one row showing the cart along the full width?

        Im asking as delegates are cell orientated and will clip to cells area pr default so spanning
        multiple might be more involving.

        This is the case, the user can click on any column in the row and it will display the inline widget below the selected row.

        I forgot about delegates being cell oriented. I may just have to increase the size of the selected row then in the model set the text alignment to the top, then manually move the widget into the right place.

        mrjjM 1 Reply Last reply
        0
        • Q Qt_User72653

          @mrjj

          @mrjj said in Displaying Widget Below QTableView Row:

          Is there only one column, or do you want the user to click any col on a row and it
          pretends its one row showing the cart along the full width?

          Im asking as delegates are cell orientated and will clip to cells area pr default so spanning
          multiple might be more involving.

          This is the case, the user can click on any column in the row and it will display the inline widget below the selected row.

          I forgot about delegates being cell oriented. I may just have to increase the size of the selected row then in the model set the text alignment to the top, then manually move the widget into the right place.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Qt_User72653
          I think its worth a shot
          but expect some fiddling around to get the chart widget to align correctly.

          I assume you will have many rows since you chose table + delegate versus
          ScrollArea with collapsible widgets.

          Q 1 Reply Last reply
          0
          • mrjjM mrjj

            @Qt_User72653
            I think its worth a shot
            but expect some fiddling around to get the chart widget to align correctly.

            I assume you will have many rows since you chose table + delegate versus
            ScrollArea with collapsible widgets.

            Q Offline
            Q Offline
            Qt_User72653
            wrote on last edited by Qt_User72653
            #5

            @mrjj

            Yep, it's a table view with an arbitrary number of rows.

            The table provides the rowViewportPosition() (or something like that), so getting the position right hopefully won't be too hard.

            mrjjM 1 Reply Last reply
            0
            • Q Qt_User72653

              @mrjj

              Yep, it's a table view with an arbitrary number of rows.

              The table provides the rowViewportPosition() (or something like that), so getting the position right hopefully won't be too hard.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Qt_User72653
              Ok then View+Model +delegate is the right way :)
              Getting the info should not be super hard but you might need to keep a pointer to the view.
              I think your plan with setting the height of the row and then make the Editor appear sounds good.
              It should work without too many odd issues :)

              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