QMacStyle: restore control size after re-initialization

We had to re-initialize NSSlider, due to some hidden problem with
stale geometry, when just setting properties of a cached control
(the remains of another previous QSlider render, using the same NSSlider).
But -initWithFrame: also resets the control size we set earlier,
thus 'small'/'mini' becoming 'normal'.

Fixes: QTBUG-107450
Pick-to: 6.4 6.2
Change-Id: Ice42c787ec65d89c1c15f9c89462b7804aafe51c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
bb10
Timur Pocheptsov 2022-10-18 13:16:43 +02:00
parent e8d6accb93
commit 942abaae59
1 changed files with 2 additions and 0 deletions

View File

@ -432,7 +432,9 @@ static bool setupSlider(NSSlider *slider, const QStyleOptionSlider *sl)
// NSSlider seems to cache values based on tracking and the last layout of the
// NSView, resulting in incorrect knob rects that break the interaction with
// multiple sliders. So completely reinitialize the slider.
const auto controlSize = slider.controlSize;
[slider initWithFrame:sl->rect.toCGRect()];
slider.controlSize = controlSize;
slider.minValue = sl->minimum;
slider.maxValue = sl->maximum;