Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Different height for table widget's rows and columns
QtWS25 Last Chance

Different height for table widget's rows and columns

Scheduled Pinned Locked Moved Solved Qt for Python
2 Posts 1 Posters 165 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.
  • M Online
    M Online
    Mizmas
    wrote on last edited by
    #1

    Hi, I have a table widget and I want the displayed data to be more close together vertically, what's the best way to do this?
    I've tried setting it up in the stylesheet like this, but only the height of the headers change

    QHeaderView::section::horizontal {
    height: 20px;
    }
    QHeaderView::section::vertical {
    height: 10px;
    }
    

    Here's how it looks like:
    Screenshot_4.png

    1 Reply Last reply
    0
    • M Online
      M Online
      Mizmas
      wrote on last edited by
      #2

      If anyone finds this, I solved it like this:

          def update_table(self, message):
              row_position = self.table_name.rowCount()
              self.table_name.insertRow(row_position)
      
              # Set the row height for the newly inserted row
              row_height = 10  # Adjust the height as needed
              self.table_name.setRowHeight(row_position, row_height)
      
      1 Reply Last reply
      0
      • SGaistS SGaist moved this topic from General and Desktop on
      • SGaistS SGaist has marked this topic as solved on

      • Login

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