From 21db5ebea9be179d325f43b5b3ca8eb5ebdae771 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Thu, 20 Apr 2017 14:23:17 +0200 Subject: Fix warnings for -no-feature-animation Change-Id: I624e68e96d2a673b36d9519d1189fe4a25e1fbd0 Reviewed-by: Paul Olav Tvete --- src/widgets/styles/qfusionstyle.cpp | 10 ++++++---- src/widgets/styles/qstylesheetstyle.cpp | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 123aa351cd..dc703e3e8d 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -2441,9 +2441,11 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption qreal expandOffset = -1.0; QObject *styleObject = option->styleObject; if (styleObject && proxy()->styleHint(SH_ScrollBar_Transient, option, widget)) { +#if QT_CONFIG(animation) qreal opacity = 0.0; bool shouldExpand = false; const qreal maxExpandScale = 13.0 / 9.0; +#endif int oldPos = styleObject->property("_q_stylepos").toInt(); int oldMin = styleObject->property("_q_stylemin").toInt(); @@ -2464,10 +2466,6 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption oldState != scrollBar->state || oldActiveControls != scrollBar->activeSubControls) { - // if the scrollbar is transient or its attributes, geometry or - // state has changed, the opacity is reset back to 100% opaque - opacity = 1.0; - styleObject->setProperty("_q_stylepos", scrollBar->sliderPosition); styleObject->setProperty("_q_stylemin", scrollBar->minimum); styleObject->setProperty("_q_stylemax", scrollBar->maximum); @@ -2476,6 +2474,10 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption styleObject->setProperty("_q_stylecontrols", static_cast(scrollBar->activeSubControls)); #ifndef QT_NO_ANIMATION + // if the scrollbar is transient or its attributes, geometry or + // state has changed, the opacity is reset back to 100% opaque + opacity = 1.0; + QScrollbarStyleAnimation *anim = qobject_cast(d->animation(styleObject)); if (transient) { if (!anim) { diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 48068adac9..5d977d75c0 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -3914,7 +3914,9 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q } QRect r = rect; +#if QT_CONFIG(animation) Q_D(const QWindowsStyle); +#endif if (pb->minimum == 0 && pb->maximum == 0) { int chunkCount = fillWidth/chunkWidth; int offset = 0; -- cgit v1.2.3