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. Setting TableView Highlight color in Linux
Forum Updated to NodeBB v4.3 + New Features

Setting TableView Highlight color in Linux

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 929 Views 1 Watching
  • 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.
  • F Offline
    F Offline
    freethewall
    wrote on last edited by
    #1

    I'm using PyQt4/PySide, but this problem occurs in both, so I think it's a Qt problem generally. I have a TableView. When I want to set the background color of highlighted table items in Windows, I can get the TableView's palette and call
    [code]palette.setColor(QPalette.Highlight, QColor(someColor))[/code]

    and that sets the background color of a highlighted item, no problem. However, this does not work in Linux. (Specifically the different versions of Ubuntu that I've tried.) Instead the highlighted color is always an orange color that Ubuntu likes to use. Is there a way to fix this? Setting other types of colors, such as QPalette.Text, works fine, it's a QPalette.Highlight issue only.

    1 Reply Last reply
    0
    • F Offline
      F Offline
      freethewall
      wrote on last edited by
      #2

      Update: No success yet, but this works on both Windows and Linux for a test QTableWidget:

      [code]table.setStyleSheet("QTableWidget::item { selection-background-color: red }")[/code]

      But the equivalent QTableView version does not do anything, strangely, so I still don't have an answer. (I'm using QTableView, the QTableWidget was just for testing.)

      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