nucleic / enaml

Declarative User Interfaces for Python
http://enaml.readthedocs.io/en/latest/
Other
1.53k stars 130 forks source link

GroupBox doesn't allow flat=True (fusion theme) #441

Closed adigitoleo closed 3 years ago

adigitoleo commented 3 years ago

I have a ScrollArea inside the GroupBox, and each draw their own border. In the docs I read that flat=True disables most of the GroupBox border, but the setting had no effect (enaml 0.12.0, QtPy 1.9.0, PySide2 5.15.2). I checked the source and the set_flat method of the proxy object is not implemented, and I couldn't find flat in container.py

Should it work? Or maybe there are better options for having a ScrollArea with a centered title above it?

Cheers

MatthieuDartiailh commented 3 years ago

Using the group_box.enaml example I cannot reproduce on either PyQt5 or PySide2. Not that the implementation you truly care about is on the proxy under the enaml.qt package.

Can you test the example and if it works there ? if it does please share your script so that I can see if there is anything wrong with it.

adigitoleo commented 3 years ago

Hmm it seems it's related to the Qt style. With the default style (empty QT_STYLE_OVERRIDE) on my machine (Arch Linux) the "flat" checkbox in the example doesn't remove the border.

However, with e.g. kvantum-dark style it works.

Edit: the default style seems to be fusion.

adigitoleo commented 3 years ago

I just ran the example with both PyQt5 and PySide2 and the outcome is the same. Presumably this is an upstream thing in the fusion style.

adigitoleo commented 3 years ago

A very quick browse of the upstream tracker didn't reveal anything yet, I might submit something if I get time to reproduce it on a pure Qt example. This seems to affect both isFlat and setFlat methods of the underlying widget, and appears to be restricted to fusion style.

The workaround for me right now is to use a VGroup with a centered Label above the ScrollArea instead.

MatthieuDartiailh commented 3 years ago

The GroupBox Qt implementation does mention that some style may ignore flat or that the differences between flat and non flat version may be minimal. I must say I tested on windows so that may be why I did not see the issue.

adigitoleo commented 3 years ago

Yep, using the windows style it is working as expected, so that's another possible workaround for me. Thanks, I'll close this since it's not an enaml issue.