On Mittwoch, 10. Juli 2013 21:41:30 CEST, Pali Rohár wrote:
I played a lot with minimal size and on my machine there are no
scrollbars. But now I think that minimal size depends on used qt
theme and so we cannot predicate correct minmal size.
So is there any way to tell general settings tab widget to set
minimal size to value when all horizontal & vertical scrollbars
will not be shown?
Scrollareas are not affected by the constraints of their viewport. That's
actually the point about scrollareas and the reason why there are scrollbars.
You'll have to filter the viewport events, intercept resizes and resize the
scrollarea to the minimum size of the viewport + the scrollarea paddings
(usually contentsMargins will do - unless there's a stylesheet in place wich
breaks this API)
Since any naive process in that regard would render scrollarea invocation
pointless in the first place, you'll usually also invoke a maximum size
(QSize::boundedTo(QSize())) - usually either a fixed value (640x480) or (a
fraction of) the QApplication::desktop()->availableGeometry()
Please do not operate on fixed values you somehow™ estimated - it's an instant
fail as the final dimensions invoke the style, the environment and eventually
even display resolution.
Cheers,
Thomas
PS: if you never used eventFilter(QObject*, bool) before and feel confused: you
want to return false and do *not* touch event acceptance =)