summaryrefslogtreecommitdiffstats
path: root/src/kernel/qstyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/qstyle.cpp')
-rw-r--r--src/kernel/qstyle.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/kernel/qstyle.cpp b/src/kernel/qstyle.cpp
index 3e8350a..e0b39b6 100644
--- a/src/kernel/qstyle.cpp
+++ b/src/kernel/qstyle.cpp
@@ -2355,12 +2355,21 @@ bool QStyle::eventFilter(QObject *o, QEvent *e) {
ControlElementFlags elementFlags = m_objectEventSourceFlagsToHandlerMap[o];
bool ret;
QWidget* w = dynamic_cast<QWidget*>(o);
- if ((w) && (e->type() == QEvent::Paint)) {
- QPainter p(w);
- QPainter* activePainterOrig = ceData.activePainter;
- const_cast<QStyleControlElementData&>(ceData).activePainter = &p;
- ret = handler->objectEventHandler(ceData, elementFlags, o, e);
- const_cast<QStyleControlElementData&>(ceData).activePainter = activePainterOrig;
+ if (w) {
+ // Update ceData as widget parameters may have changed
+ // If not done glitches may appear such as those present in Bug 1816
+ populateControlElementDataFromWidget(w, QStyleOption());
+ const QStyleControlElementData &widgetCEData = *(w->controlElementDataObject());
+ if (e->type() == QEvent::Paint) {
+ QPainter p(w);
+ QPainter* activePainterOrig = widgetCEData.activePainter;
+ const_cast<QStyleControlElementData&>(widgetCEData).activePainter = &p;
+ ret = handler->objectEventHandler(widgetCEData, elementFlags, o, e);
+ const_cast<QStyleControlElementData&>(widgetCEData).activePainter = activePainterOrig;
+ }
+ else {
+ ret = handler->objectEventHandler(widgetCEData, elementFlags, o, e);
+ }
}
else {
ret = handler->objectEventHandler(ceData, elementFlags, o, e);