From 93b3efa8902c19e9b67114652dc84c463f8c219a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 7 Aug 2014 13:08:29 -0500 Subject: Refresh control element data structures before executing style object event handlers This resolves Bug 1816 Fix FTBFS in style examples --- src/kernel/qstyle.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/kernel/qstyle.cpp') 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(o); - if ((w) && (e->type() == QEvent::Paint)) { - QPainter p(w); - QPainter* activePainterOrig = ceData.activePainter; - const_cast(ceData).activePainter = &p; - ret = handler->objectEventHandler(ceData, elementFlags, o, e); - const_cast(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(widgetCEData).activePainter = &p; + ret = handler->objectEventHandler(widgetCEData, elementFlags, o, e); + const_cast(widgetCEData).activePainter = activePainterOrig; + } + else { + ret = handler->objectEventHandler(widgetCEData, elementFlags, o, e); + } } else { ret = handler->objectEventHandler(ceData, elementFlags, o, e); -- cgit v1.2.1