diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-08-07 13:08:29 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-08-07 13:08:29 -0500 |
commit | 93b3efa8902c19e9b67114652dc84c463f8c219a (patch) | |
tree | aa0f907f2c1c2f2dd6da5b8ca9c09f41c56be11b /src | |
parent | 71a6d7870f609df603d9520a8d292055ea5928c3 (diff) | |
download | qt3-93b3efa8902c19e9b67114652dc84c463f8c219a.tar.gz qt3-93b3efa8902c19e9b67114652dc84c463f8c219a.zip |
Refresh control element data structures before executing style object event handlers
This resolves Bug 1816
Fix FTBFS in style examples
Diffstat (limited to 'src')
-rw-r--r-- | src/kernel/qstyle.cpp | 21 |
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); |