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. How to insert widget into QTableView's viewport?
Forum Updated to NodeBB v4.3 + New Features

How to insert widget into QTableView's viewport?

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

    Is there a way to insert a widget at the bottom of a table, below the last row but above the horizontal scroll bar?

    Edit: If there's no way to do this, is there a way to make a QTableView automatically resize it's height to fit it's contents? I can nest the QTableView with the widget I want at the bottom, inside of a QScrollArea.

    VRoninV 1 Reply Last reply
    0
    • Q Qt_User72653

      Is there a way to insert a widget at the bottom of a table, below the last row but above the horizontal scroll bar?

      Edit: If there's no way to do this, is there a way to make a QTableView automatically resize it's height to fit it's contents? I can nest the QTableView with the widget I want at the bottom, inside of a QScrollArea.

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      @Qt_User72653 said in How to insert widget into QTableView's viewport?:

      is there a way to make a QTableView automatically resize it's height to fit it's contents? I can nest the QTableView with the widget I want at the bottom, inside of a QScrollArea.

      I think this is indeed the way to go. you can call QTableView::setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents) to make it automatically resize

      "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
      3
      • Q Offline
        Q Offline
        Qt_User72653
        wrote on last edited by
        #3

        The AdjustToContents flag doesn't seem to be doing anything. I can set a fixed height for the embedded table, which works, but then I'd have to reset the table size every time data is added.

        VRoninV 1 Reply Last reply
        0
        • Q Qt_User72653

          The AdjustToContents flag doesn't seem to be doing anything. I can set a fixed height for the embedded table, which works, but then I'd have to reset the table size every time data is added.

          VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          @Qt_User72653 said in How to insert widget into QTableView's viewport?:

          The AdjustToContents flag doesn't seem to be doing anything

          I doubt it. I use this extensively. can you show your code

          "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
          0
          • Q Offline
            Q Offline
            Qt_User72653
            wrote on last edited by
            #5

            Not at the moment, I'm in the middle of trying to convert the old table to the new nested table, so I'm still not completely sure what's relevant or not.

            I do wonder, though, if the container scroll area is forcing a size contraint on the embedded table.

            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