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 resize QTableWidget width to fit the total column size?

How to resize QTableWidget width to fit the total column size?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 2.5k 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.
  • L Offline
    L Offline
    lachdanan
    wrote on last edited by lachdanan
    #1

    Hi,

    I am trying to get the layout of my app setup and so I added 2 QTableWidgets side by size but as you can see, there is a gap here in each QTableView after the last column. Is there a way to resize the widget to full encapculate the columns without this empty space?

    I tried this but it didn't change anything:

    tablewidget.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
    

    https://i.imgur.com/qeGHlxO.png

    Thanks in advance.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lachdanan
      wrote on last edited by
      #2

      Ok this worked:

      self.setSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Expanding)
      
      1 Reply Last reply
      2

      • Login

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