QMenu indicator style sheet undesired behaviour
Hello there,
In one of my projects, I used to define my own application theme (via style sheets).
Everything worked fine except when I tried to set an image for the QMenu::indicator:exclusive:checked state.
In fact, it works fine for the checked item but it generates collateral undesired behaviour over unchecked items.
Indeed, if I define an image for the checked indicator, the unchecked indicators become sunk and I don't understand why (and nothing worked to remove it: removing borders, changing border-style, setting an empty image, setting a not empty image, ... nothing seems to affect this ugly sunken border).
You can find the details (context, screenshots, ...) of the problem in the original question here.
If someone has an idea of how to get rid of it, I would be very grateful.
Thanks in advance for those who will spend some time to help me.
EDIT: After performing additional tests, it seems to be a bug. I reported it on the Qt bug tracker, you can find it here.
Re: QMenu indicator style sheet undesired behaviour
Stylesheets are nice for small and few changes, for anything beyond that it is usually a better idea to invest in a proper QProxyStyle.
Cheers,
_
Re: QMenu indicator style sheet undesired behaviour
First of all, thank you for your answer.
I agree with this for elaborated design, it is better to use something else than stylesheets.
But, I think even for the style of a whole application, if we stay in the scope of stylesheets capabilities, I don't see a reason why it should be bad to use them.
The problem here is that I don't have any elaborated effects that exceed the stylesheets capabilities and applying the stylesheet does not behave as it should do.
So the problem is not about stylesheets capabilities but more about the way they are implemented in Qt (what Qt does when we apply a stylesheet with setStyleSheet()). And this is where I found the bug.
In the bug report, I have added a minimal and complete example to reproduce the bug.
Thanks for your advice anyway :)
Re: QMenu indicator style sheet undesired behaviour
There is some example of QMenu indicator stylesheet here : https://qss-stock.devsecstudio.com
Re: QMenu indicator style sheet undesired behaviour
Have you found any workaround for this bug?
Maybe it is possible to customize checkmark without drawing this frame for unchecked state?