macOS: Don't draw scrollbar handle when there is no range

If the minimum and maximum is set to be the same then we should not
draw the handle. An empty groove should be shown instead.

Change-Id: Ie79f55cd761f9a8f614967c40c23a7f59e700a0f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit aac33296e618e617ab9e05b3c71682a13f2d5dfc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Andy Shaw 2021-03-10 12:22:32 +01:00 committed by Qt Cherry-pick Bot
parent eb21e8f7d9
commit fe7bf854f8

View File

@ -5181,7 +5181,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
if (const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { if (const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
const bool drawTrack = sb->subControls & SC_ScrollBarGroove; const bool drawTrack = sb->subControls & SC_ScrollBarGroove;
const bool drawKnob = sb->subControls & SC_ScrollBarSlider; const bool drawKnob = sb->subControls & SC_ScrollBarSlider && sb->minimum != sb->maximum;
if (!drawTrack && !drawKnob) if (!drawTrack && !drawKnob)
break; break;