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. Default QPalette::Text is the same for QPalette.Active and QPalette::Disabled?

Default QPalette::Text is the same for QPalette.Active and QPalette::Disabled?

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 173 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.
  • P Offline
    P Offline
    patrickkidd
    wrote on last edited by
    #1

    A default QListView (on macOS) paints text with a white color when enabled and grey color when disabled, which is correct. However, listView.palette().color(QPalette.Active, QPalette.Text) returns white just the same as listView.palette().color(QPalette.Disabled, QPalette.Text).

    What gives? Why doesn't the second call return the grey color that is actually used?

    Full example:

    app = QApplication(sys.argv)
    w = QListWidget()
    w.addItem('Here')
    w.addItem('You')
    w.addItem('Are')
    w.show()
    w.activateWindow()
    
    print('w   QPalette.Active', w.palette().color(QPalette.Active, QPalette.Text).name())
    print('w   QPalette.Disabled', w.palette().color(QPalette.Disabled, QPalette.Text).name())
    print('app QPalette.Active', app.palette().color(QPalette.Active, QPalette.Text).name())
    print('app QPalette.Disabled', app.palette().color(QPalette.Disabled, QPalette.Text).name())
    
    app.exec()
    

    outputs:

    turin:pkdiagram patrick$ python test.py
    w   QPalette.Active #ffffff
    w   QPalette.Disabled #ffffff
    app QPalette.Active #ffffff
    app QPalette.Disabled #ffffff
    

    https://alaskafamilysystems.com/

    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