[PyQt] How do I find the system colour-theme?

Baz Walter bazwal at ftml.net
Fri Aug 27 17:34:12 BST 2010


On 27/08/10 11:07, Jonathan Noble wrote:
> Hi, I am using a QTableWidget that needs to have one row's background colour
> changed. However, I do not know how to reset the change based on the systems
> colour theme.
>
> This image shows what happens if I do not do hackish reset:
> http://www.flickr.com/photos/jonnobleuk/4931228167/
>
> This image shows what happens if I use the hackish fix if In a foreign
> colour theme:
> http://gereqi.googlecode.com/issues/attachment?aid=4972320403488235356&name=gereqi-theme-issue.png&token=25ed6a0bb6f47c881d5e410f32a2d5fb&inline=1
>
> How do I find the colour-theme?

palette = mytablewidget.palette()

# row colours
palette.base().color()
palette.alternateBase().color()

# selection colours
palette.highlight().color()
palette.highlightedText().color()

see:

http://doc.qt.nokia.com/4.6/qwidget.html#palette-prop
http://doc.qt.nokia.com/4.6/qpalette.html#ColorGroup-enum


More information about the PyQt mailing list