summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-02-08 12:08:56 +0100
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-02-10 12:43:45 +0000
commit5cf6a8a50cc9777a5d571882c59608508022630b (patch)
tree570ace9ce7301d68c50cedc58189b8547c963776 /src
parent6cb462d7aa063e5d7bcf3877fa7e7e1c4cacf3ff (diff)
QWindowsVistaStyle: Suppress animation when QLineEdit's base color is set.
Introduce utility function to check using QWindowsXPStylePrivate::isLineEditBaseColorSet(). Task-number: QTBUG-40634 Change-Id: Iaa6962a17217352aa59d0c54421b764ad47d3bf8 Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index 52fc2e4af2..d900e4d181 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -213,6 +213,26 @@ void QWindowsVistaAnimation::paint(QPainter *painter, const QStyleOption *option
painter->drawImage(option->rect, currentImage());
}
+static inline bool supportsStateTransition(QStyle::PrimitiveElement element,
+ const QStyleOption *option,
+ const QWidget *widget)
+{
+ bool result = false;
+ switch (element) {
+ case QStyle::PE_IndicatorRadioButton:
+ case QStyle::PE_IndicatorCheckBox:
+ result = true;
+ break;
+ // QTBUG-40634, do not animate when color is set in palette for PE_PanelLineEdit.
+ case QStyle::PE_FrameLineEdit:
+ result = !QWindowsXPStylePrivate::isLineEditBaseColorSet(option, widget);
+ break;
+ default:
+ break;
+ }
+ return result;
+}
+
/*!
\internal
@@ -243,6 +263,7 @@ void QWindowsVistaAnimation::paint(QPainter *painter, const QStyleOption *option
starting image for the hover transition.
*/
+
void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
QPainter *painter, const QWidget *widget) const
{
@@ -259,11 +280,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
QRect oldRect;
QRect newRect;
- /* widgets that support state transitions : */
- if ( element == PE_FrameLineEdit
- || element == PE_IndicatorRadioButton
- || element == PE_IndicatorCheckBox)
- {
+ if (supportsStateTransition(element, option, widget)) {
// Retrieve and update the dynamic properties tracking
// the previous state of the widget:
QObject *styleObject = option->styleObject;