Request border size
-
Hi,
We have a global stylesheet set on the app with a lot of rules.
For a specific widget, I'd like to know what is the border width (border top, left, etc.) that is applied.
Those rules are applied in cascad so parsing the stylesheet string seems to be complex.I've check the QStyle documentation but found nothing usefull.
Any idea ?
Thanks -
Hi,
Stylesheet are applied through a custom QStyle subclass you currently don't have access to.
What would you like to do with that information ?
-
I would like to make a screenshot of the widget without considering its border.
auto pixmap = myWidget->grab();
works well but the border is included.
The idea would be to set a custom size to thegrab()
method by taking the widget geometry and removing the border dimensions. -
What widget is that ?
-
Because depending on the widget you might be able to render it's content rather than the widget itself.
For example, in a dock widget, you usually set a widget in it, so if your render that widget, you won't have the QDockWidget itself in the rendered part.
-
That was a suggestion I thought I already made :)
Good that you have found a solution and thanks for sharing.