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. Can QHeaderView (horizontal) resize its height to its header label text?
Forum Updated to NodeBB v4.3 + New Features

Can QHeaderView (horizontal) resize its height to its header label text?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 941 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.
  • qwasder85Q Offline
    qwasder85Q Offline
    qwasder85
    wrote on last edited by
    #1

    I'm using a slightly larger than default font size for my table headers

    my_table->horizontalHeader()->setStyleSheet( QString( "QHeaderView { font-size: 12px; }" )
    

    which results in some letters being cropped at the bottom (g, j,...).
    I don't want to set a fixed height for the header, since it introduces issues on high-DPI screens. Is there a way to have the QHeaderView adapt its height to the text, like a QPushButton does?
    If the answer is "custom paint()", I'll rather remove all the g's and j's from my header texts, haha... ;(

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      There is a bug for this already: https://bugreports.qt.io/browse/QTBUG-56457

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      3
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Ok, the bug seems to be not exactly your problem but maybe related. Can you please provide a complete minimal testcase to reproduce the issue? What OS and Qt version do you use?

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        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