Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Request border size
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 ?
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 the
grab()method by taking the widget geometry and removing the border dimensions.
What widget is that ?
In my case, it's a dock widget. Why does it matter ?
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.
I need also the title widget...
The solution I've found (which is not optimal) is to take the widget rect and remove the layout content margins.
It works pretty well.
That was a suggestion I thought I already made :)
Good that you have found a solution and thanks for sharing.