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
Change-Id: Ice42c787ec65d89c1c15f9c89462b7804aafe51c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 942abaae595ea620bdeacba0f4a18b759785d61b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Timur Pocheptsov 2022-10-18 13:16:43 +02:00 committed by Qt Cherry-pick Bot
parent a40be64759
commit c4405bc5d7

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;