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. Adjust the height of a cell in QTableWidget using stylesheets
Forum Updated to NodeBB v4.3 + New Features

Adjust the height of a cell in QTableWidget using stylesheets

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.2k 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
    leinad
    wrote on last edited by
    #1

    Hi,

    I have several QtableWidgets in my application, and I noticed the height of the cells in the tables are a little larger than I would like. I prefer to change the height using a stylesheet rather than programmatically adjust the height for each table in code. I checked the stylesheet documentation but couldn't seem to find an answer but perhaps I missed something.

    Is it possible to do this using a stylesheet?

    Thanks!

    JonBJ 1 Reply Last reply
    0
    • L leinad

      Hi,

      I have several QtableWidgets in my application, and I noticed the height of the cells in the tables are a little larger than I would like. I prefer to change the height using a stylesheet rather than programmatically adjust the height for each table in code. I checked the stylesheet documentation but couldn't seem to find an answer but perhaps I missed something.

      Is it possible to do this using a stylesheet?

      Thanks!

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @leinad said in Adjust the height of a cell in QTableWidget using stylesheets:

      I checked the stylesheet documentation but couldn't seem to find an answer but perhaps I missed something.

      I believe that is because you cannot change row heights from QSS.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        leinad
        wrote on last edited by
        #3

        So basically I can't use a stylesheet?

        1 Reply Last reply
        0
        • JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by
          #4
          table_wdiget->verticalHeader()->setDefaultSectionSize( item_height );
          

          use vertical header view stylesheet. However, I did not see item height setting
          https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qheaderview

          1 Reply Last reply
          1
          • L Offline
            L Offline
            leinad
            wrote on last edited by
            #5

            Ok, thanks.

            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