Mercurial > hg > tilerswift
changeset 53:4a4c74d920bc
ColourButton: always use plastique style, not system style
Some other styles don't seem to allow recolouring:
https://bugreports.qt.io/browse/QTBUG-11089
Looks like the solution is to instead pick a different style just for this widget.
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Sat, 07 Sep 2019 13:05:16 -0400 |
parents | 406899afca32 |
children | 2e9f6582c3d2 |
files | tilerswift |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tilerswift +++ b/tilerswift @@ -4,6 +4,8 @@ from colors import NES_PALETTE +PLASTIQUE = QtWidgets.QStyleFactory().create("Plastique") + def read_rom(filename): with open(filename, 'rb') as f: ines = f.read() @@ -277,6 +279,10 @@ self.colour_idx = colour_idx self.set_colour(colour_idx) + # Native styles sometimes don't allow recolouring the + # background, see https://bugreports.qt.io/browse/QTBUG-11089 + self.setStyle(PLASTIQUE) + def set_colour(self, colour_idx): self.colour_idx = colour_idx self.setText(f"{colour_idx:0{2}X}")