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. CSS + QTableView/QHeaderView: font-weight ignored?

CSS + QTableView/QHeaderView: font-weight ignored?

Scheduled Pinned Locked Moved Solved General and Desktop
stylesheetqheaderviewqtableview
3 Posts 2 Posters 3.3k 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.
  • the_T Offline
    the_T Offline
    the_
    wrote on last edited by the_
    #1

    Hi all,

    As the title says...
    When selecting a table row the default behaviour is to set the vertical and horizontal header(s) to bold.

    My attempt was to force the font to be "normal" weight, but that did not work, but other properties could be set without problems using css.

    Example:

    QHeaderView::section:checked {font: 19px; color:blue;}
    QHeaderView::section {font: 19px; color:green;}
    

    works as expected and sets the text color to blue when clicking a row, green if not.

    Trying with

    QHeaderView::section:checked {font: normal 19px; color:blue;}
    QHeaderView::section {font: 19px; color:green;}
    

    does the same...
    screenshot
    Any ideas what I did wrong?

    -- No support in PM --

    raven-worxR 1 Reply Last reply
    0
    • the_T the_

      Hi all,

      As the title says...
      When selecting a table row the default behaviour is to set the vertical and horizontal header(s) to bold.

      My attempt was to force the font to be "normal" weight, but that did not work, but other properties could be set without problems using css.

      Example:

      QHeaderView::section:checked {font: 19px; color:blue;}
      QHeaderView::section {font: 19px; color:green;}
      

      works as expected and sets the text color to blue when clicking a row, green if not.

      Trying with

      QHeaderView::section:checked {font: normal 19px; color:blue;}
      QHeaderView::section {font: 19px; color:green;}
      

      does the same...
      screenshot
      Any ideas what I did wrong?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @the_ said:

      Any ideas what I did wrong?

      probably nothing. Some stuff is simply overwritten by the QStyle implementation.
      i can't tell you for sure that this is the case here. Would have to step through QStyle methods to see what happens with the font during painting.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      the_T 1 Reply Last reply
      0
      • raven-worxR raven-worx

        @the_ said:

        Any ideas what I did wrong?

        probably nothing. Some stuff is simply overwritten by the QStyle implementation.
        i can't tell you for sure that this is the case here. Would have to step through QStyle methods to see what happens with the font during painting.

        the_T Offline
        the_T Offline
        the_
        wrote on last edited by the_
        #3

        @raven-worx
        Hi,

        thanks for your reply and information.
        Will mark it as "solved", as it is only a minor but interesting styling "issue" :)

        -- No support in PM --

        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