summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/qcommonstyle.cpp5
-rw-r--r--src/widgets/styles/qstyle.cpp9
-rw-r--r--src/widgets/styles/qstyle.h1
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp4
4 files changed, 15 insertions, 4 deletions
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<const QTreeView*>(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;
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 7e37d10cb5..0350d5e1a5 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -1972,9 +1972,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
a tooltip is shown (notice: shown, not hidden). When a new wake isn't needed, a user-requested tooltip
will be shown nearly instantly.
- \value SH_Widget_Animate Determines if the widget should show animations or not, for example
- a transition between checked and unchecked statuses in a checkbox.
- This enum value has been introduced in Qt 5.2.
+ \value SH_Widget_Animate Deprecated. Use \l{SH_Widget_Animation_Duration} instead.
\value SH_Splitter_OpaqueResize Determines if resizing is opaque
This enum value has been introduced in Qt 5.2
@@ -1992,6 +1990,11 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
The Mac style, for example, sets this to false.
This enum value has been introduced in Qt 5.10.
+ \value SH_Widget_Animation_Duration
+ Determines how much an animation should last (in ms).
+ A value equal to zero means that the animations will be disabled.
+ This enum value has been introduced in Qt 5.10.
+
\sa styleHint()
*/
diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h
index ae5ddbcd1f..b4936a3e0a 100644
--- a/src/widgets/styles/qstyle.h
+++ b/src/widgets/styles/qstyle.h
@@ -738,6 +738,7 @@ public:
SH_Menu_SubMenuDontStartSloppyOnLeave,
SH_ItemView_ScrollMode,
SH_TitleBar_ShowToolTipsOnButtons,
+ SH_Widget_Animation_Duration,
// Add new style hint values here
SH_CustomBase = 0xf0000000
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 39a3e110f3..4fe697a32f 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -691,7 +691,8 @@ static const char knownStyleHints[][45] = {
"titlebar-unshade-icon",
"toolbutton-popup-delay",
"trash-icon",
- "uparrow-icon"
+ "uparrow-icon",
+ "widget-animation-duration"
};
static const int numKnownStyleHints = sizeof(knownStyleHints)/sizeof(knownStyleHints[0]);
@@ -5325,6 +5326,7 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi
case SH_ItemView_ArrowKeysNavigateIntoChildren: s = QLatin1String("arrow-keys-navigate-into-children"); break;
case SH_ItemView_PaintAlternatingRowColorsForEmptyArea: s = QLatin1String("paint-alternating-row-colors-for-empty-area"); break;
case SH_TitleBar_ShowToolTipsOnButtons: s = QLatin1String("titlebar-show-tooltips-on-buttons"); break;
+ case SH_Widget_Animation_Duration: s = QLatin1String("widget-animation-duration"); break;
default: break;
}
if (!s.isEmpty() && rule.hasStyleHint(s)) {