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>
This commit is contained in:
parent
6cb462d7aa
commit
5cf6a8a50c
@ -213,6 +213,26 @@ void QWindowsVistaAnimation::paint(QPainter *painter, const QStyleOption *option
|
|||||||
painter->drawImage(option->rect, currentImage());
|
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
|
\internal
|
||||||
|
|
||||||
@ -243,6 +263,7 @@ void QWindowsVistaAnimation::paint(QPainter *painter, const QStyleOption *option
|
|||||||
starting image for the hover transition.
|
starting image for the hover transition.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
|
void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
|
||||||
QPainter *painter, const QWidget *widget) const
|
QPainter *painter, const QWidget *widget) const
|
||||||
{
|
{
|
||||||
@ -259,11 +280,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
|
|||||||
QRect oldRect;
|
QRect oldRect;
|
||||||
QRect newRect;
|
QRect newRect;
|
||||||
|
|
||||||
/* widgets that support state transitions : */
|
if (supportsStateTransition(element, option, widget)) {
|
||||||
if ( element == PE_FrameLineEdit
|
|
||||||
|| element == PE_IndicatorRadioButton
|
|
||||||
|| element == PE_IndicatorCheckBox)
|
|
||||||
{
|
|
||||||
// Retrieve and update the dynamic properties tracking
|
// Retrieve and update the dynamic properties tracking
|
||||||
// the previous state of the widget:
|
// the previous state of the widget:
|
||||||
QObject *styleObject = option->styleObject;
|
QObject *styleObject = option->styleObject;
|
||||||
|
Loading…
Reference in New Issue
Block a user