From 04eba7b538072e2811f074bf66fd41f27c90b35c Mon Sep 17 00:00:00 2001 From: Elvis Angelaccio Date: Fri, 26 May 2017 12:51:33 +0200 Subject: QStyle: deprecate SH_Widget_Animate in favor of SH_Widget_Animation_Duration This change introduces a new SH_Widget_Animation_Duration style hint that applications can query instead of manually hardcoding the duration of an animation. As default value we use 200, which is the value that was already used in QWidgetAnimator. A value equal to 0 means that the animations will be disabled. This also implies that the SH_Widget_Animate style hint is superseded and can be deprecated. The new style hint is configurable with style sheets. [ChangeLog][QtWidgets][Styles] Added SH_Widget_Animation_Duration style hint which deprecates SH_Widget_Animate. Change-Id: Ic3f5e4f7145a89697f28666aeaecabb1f3c5c96f Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/styles/qcommonstyle.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/widgets/styles/qcommonstyle.cpp') diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 477d180a2b..0c1cf0ec6e 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5246,6 +5246,8 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget break; #endif case SH_Widget_Animate: + // TODO Qt6: move this code in the SH_Widget_Animation_Duration case + // and replace false with 0 and true with 200. #ifndef QT_NO_TREEVIEW if (qobject_cast(widget)) { ret = false; @@ -5266,6 +5268,9 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget case SH_TitleBar_ShowToolTipsOnButtons: ret = true; break; + case SH_Widget_Animation_Duration: + ret = styleHint(SH_Widget_Animate, opt, widget, hret) ? 200 : 0; + break; default: ret = 0; break; -- cgit v1.2.3