Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTableWidget stretchFirstColumn
Qt 6.12 LTS is out! See what's new in the release blog

QTableWidget stretchFirstColumn

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.1k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I have a table that I want the first column to take all available space. All of the other columns are set to resizeColumnToContents(); Is there a way to accommodate this?

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      If you set the last column to fixed size (or size to contents) and only the first column is not set to a fixed column, the first column should expand/shrink automatic. (if the TableWidget is placed in a Layout)

      Greetz, Jeroen

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        The table is in a layout and there seems to be a small space to the right between the last column and the edge of the table.

        I did this and the area still remains so I assume it has something to do with scrollbars or something:

        int w =verticalHeader()->width();
        for (int i = 1; i < columnCount(); i++)
        w += columnWidth(i);
        setColumnWidth(0, width() - w);

        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
        • Unsolved