Quote:
Originally Posted by KevinH
If you want me to try to create a python version, just let me know and I will take a shot at it.
|
Thanks! But reading a bit of C++ every now and then is a good exercise, I don't dislike it.
It's really interesting to delve into the gritty details of the painting process, I'll look at it more when I'll port to PySide the next plugin.
For now I'm sticking with the QCheckBox + QLabel approach: I discovered that by removing every explicit 'setAlignment' from the QHBoxLayout that keep the two widgets together I solved the issues with the QLabel word wrap, which now "just works" without dabbling with show and resize events.
After that, I just had to add a bit coarse solution to the very-long-words-that-wont-wrap problem: I set a minimum width for the window, then in the showEvent of the checkboxes I compute the horizontal advancement of every word and if one is wider than the available width I intersperse every character of that word with zero-width spaces.
@BeckyEbook: I wasn't using match_dark_palette, the dark colors were due to the system settings, but they weren't exactly identical to Sigil, thanks!
The only issue I had with the Sigil palette, is that I was using the role QtGui.QPalette.AlternateBase to paint alternating rows backgrounds, but in the Sigil palette that role is identical to the standard background, so now I check if the AlternateBase color is equal to the background of the widget and if so I use another one, something like:
Code:
bgColor = widget.palette().color(widget.backgroundRole())
alternateBgColor = widget.palette().color(QtGui.QPalette.AlternateBase)
if bgColor.getRgb() == alternateBgColor.getRgb():
alternateBgColor = widget.palette().color(QtGui.QPalette.Base)