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 change QTableWidget header color and selection color ?
QtWS25 Last Chance

How to change QTableWidget header color and selection color ?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 26.1k 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.
  • sonichyS Offline
    sonichyS Offline
    sonichy
    wrote on last edited by sonichy
    #1

    Solved!

    tableWidget->setStyleSheet("QTableView::item:selected { color:white; background:#000000; font-weight:900; }"
                               "QTableCornerButton::section { background-color:#232326; }"
                               "QHeaderView::section { color:white; background-color:#232326; }");
    

    alt text

    https://github.com/sonichy

    1 Reply Last reply
    1
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtableview
      http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qheaderview

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      3
      • R Offline
        R Offline
        Rekols
        wrote on last edited by
        #3

        try:

        QHeaderView::section {
            background-color: rgb(255, 255, 255);
            border: none;
            height: 32px;
        }
        
        1 Reply Last reply
        5

        • Login

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