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.cpp78
1 files changed, 42 insertions, 36 deletions
diff --git a/src/kernel/qstyle.cpp b/src/kernel/qstyle.cpp
index 75757c9..eb12c1b 100644
--- a/src/kernel/qstyle.cpp
+++ b/src/kernel/qstyle.cpp
@@ -637,8 +637,8 @@ QStyle::~QStyle()
\sa unPolish()
*/
void QStyle::polish( QWidget *widget ) {
- QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, QStyleOption());
- polish(ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, QStyleOption()), widget);
+ const QStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, QStyleOption());
+ polish(ceData, getControlElementFlagsForObject(widget, QStyleOption()), widget);
}
/*!
@@ -652,8 +652,8 @@ void QStyle::polish( QWidget *widget ) {
\sa polish()
*/
void QStyle::unPolish( QWidget *widget ) {
- QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, QStyleOption());
- unPolish(ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, QStyleOption()), widget);
+ const QStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, QStyleOption());
+ unPolish(ceData, getControlElementFlagsForObject(widget, QStyleOption()), widget);
}
/*!
@@ -715,8 +715,8 @@ void QStyle::unPolish( const QStyleControlElementData &ceData, ControlElementFla
\sa unPolish()
*/
void QStyle::polish( QApplication *app ) {
- QStyleControlElementData ceData = populateControlElementDataFromApplication(app, QStyleOption());
- applicationPolish(ceData, getControlElementFlagsForObject(app, ceData.widgetObjectTypes, QStyleOption()), app);
+ const QStyleControlElementData &ceData = populateControlElementDataFromApplication(app, QStyleOption());
+ applicationPolish(ceData, getControlElementFlagsForObject(app, QStyleOption()), app);
}
/*!
@@ -727,8 +727,8 @@ void QStyle::polish( QApplication *app ) {
\sa polish()
*/
void QStyle::unPolish( QApplication *app ) {
- QStyleControlElementData ceData = populateControlElementDataFromApplication(app, QStyleOption());
- applicationUnPolish(ceData, getControlElementFlagsForObject(app, ceData.widgetObjectTypes, QStyleOption()), app);
+ const QStyleControlElementData &ceData = populateControlElementDataFromApplication(app, QStyleOption());
+ applicationUnPolish(ceData, getControlElementFlagsForObject(app, QStyleOption()), app);
}
/*!
@@ -782,8 +782,8 @@ void QStyle::polish( QPalette&)
checkable by default (\l{QPopupMenu::setCheckable()}).
*/
void QStyle::polishPopupMenu( QPopupMenu *pm ) {
- QStyleControlElementData ceData = populateControlElementDataFromWidget(pm, QStyleOption());
- unPolish(ceData, getControlElementFlagsForObject(pm, ceData.widgetObjectTypes, QStyleOption()), pm);
+ const QStyleControlElementData &ceData = populateControlElementDataFromWidget(pm, QStyleOption());
+ unPolish(ceData, getControlElementFlagsForObject(pm, QStyleOption()), pm);
}
/*!
@@ -2351,14 +2351,16 @@ bool QStyle::eventFilter(QObject *o, QEvent *e) {
if (m_objectEventSourceToHandlerMap.contains(o)) {
QStyle* handler = m_objectEventSourceToHandlerMap[o];
- QStyleControlElementData ceData = m_objectEventSourceDataToHandlerMap[o];
+ const QStyleControlElementData &ceData = m_objectEventSourceDataToHandlerMap[o];
ControlElementFlags elementFlags = m_objectEventSourceFlagsToHandlerMap[o];
bool ret;
QWidget* w = dynamic_cast<QWidget*>(o);
if ((w) && (e->type() == QEvent::Paint)) {
QPainter p(w);
- ceData.activePainter = &p;
+ QPainter* activePainterOrig = ceData.activePainter;
+ const_cast<QStyleControlElementData&>(ceData).activePainter = &p;
ret = handler->objectEventHandler(ceData, elementFlags, o, e);
+ const_cast<QStyleControlElementData&>(ceData).activePainter = activePainterOrig;
}
else {
ret = handler->objectEventHandler(ceData, elementFlags, o, e);
@@ -2638,8 +2640,8 @@ void QStyle::drawPrimitive( PrimitiveElement pe,
}
}
- QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
- drawPrimitive(pe, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, QStyleOption()), r, cg, flags, opt);
+ const QStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, opt);
+ drawPrimitive(pe, p, ceData, getControlElementFlagsForObject(widget, QStyleOption()), r, cg, flags, opt);
}
void QStyle::drawControl( ControlElement element,
@@ -2657,8 +2659,8 @@ void QStyle::drawControl( ControlElement element,
}
#endif
- QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
- drawControl(element, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, opt), r, cg, flags, opt, widget);
+ const QStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, opt);
+ drawControl(element, p, ceData, getControlElementFlagsForObject(widget, opt), r, cg, flags, opt, widget);
}
void QStyle::drawControlMask( ControlElement control,
@@ -2667,8 +2669,8 @@ void QStyle::drawControlMask( ControlElement control,
const QRect &r,
const QStyleOption& opt ) const
{
- QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
- drawControlMask(control, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, opt), r, opt, widget);
+ const QStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, opt);
+ drawControlMask(control, p, ceData, getControlElementFlagsForObject(widget, opt), r, opt, widget);
}
QRect QStyle::subRect(SubRect r, const QWidget *widget) const
@@ -2680,8 +2682,8 @@ QRect QStyle::subRect(SubRect r, const QWidget *widget) const
}
#endif
- QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, QStyleOption());
- return subRect(r, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, QStyleOption()), widget);
+ const QStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, QStyleOption());
+ return subRect(r, ceData, getControlElementFlagsForObject(widget, QStyleOption()), widget);
}
void QStyle::drawComplexControl( ComplexControl control,
@@ -2701,8 +2703,8 @@ void QStyle::drawComplexControl( ComplexControl control,
}
#endif
- QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
- drawComplexControl(control, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, QStyleOption()), r, cg, flags, controls, active, opt, widget);
+ const QStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, opt);
+ drawComplexControl(control, p, ceData, getControlElementFlagsForObject(widget, QStyleOption()), r, cg, flags, controls, active, opt, widget);
}
void QStyle::drawComplexControlMask( ComplexControl control,
@@ -2711,8 +2713,8 @@ void QStyle::drawComplexControlMask( ComplexControl control,
const QRect &r,
const QStyleOption& opt ) const
{
- QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
- drawComplexControlMask(control, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, QStyleOption()), r, opt, widget);
+ const QStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, opt);
+ drawComplexControlMask(control, p, ceData, getControlElementFlagsForObject(widget, QStyleOption()), r, opt, widget);
}
QRect QStyle::querySubControlMetrics( ComplexControl control,
@@ -2727,8 +2729,8 @@ QRect QStyle::querySubControlMetrics( ComplexControl control,
}
#endif
- QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt, false);
- return querySubControlMetrics(control, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, QStyleOption()), sc, opt, widget);
+ const QStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, opt, false);
+ return querySubControlMetrics(control, ceData, getControlElementFlagsForObject(widget, QStyleOption()), sc, opt, widget);
}
QStyle::SubControl QStyle::querySubControl(ComplexControl control,
@@ -2736,14 +2738,14 @@ QStyle::SubControl QStyle::querySubControl(ComplexControl control,
const QPoint &pos,
const QStyleOption& opt ) const
{
- QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
- return querySubControl(control, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, opt), pos, opt, widget);
+ const QStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, opt);
+ return querySubControl(control, ceData, getControlElementFlagsForObject(widget, opt), pos, opt, widget);
}
int QStyle::pixelMetric(PixelMetric m, const QWidget *widget) const
{
- QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, QStyleOption());
- return pixelMetric(m, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, QStyleOption()), widget);
+ const QStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, QStyleOption(), false);
+ return pixelMetric(m, ceData, getControlElementFlagsForObject(widget, QStyleOption()), widget);
}
QSize QStyle::sizeFromContents(ContentsType contents,
@@ -2760,8 +2762,8 @@ QSize QStyle::sizeFromContents(ContentsType contents,
}
#endif
- QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
- return sizeFromContents(contents, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, QStyleOption()), contentsSize, opt, widget);
+ const QStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, opt);
+ return sizeFromContents(contents, ceData, getControlElementFlagsForObject(widget, QStyleOption()), contentsSize, opt, widget);
}
int QStyle::styleHint(StyleHint sh, const QWidget * w, const QStyleOption &so, QStyleHintReturn *shr) const
@@ -2770,14 +2772,14 @@ int QStyle::styleHint(StyleHint sh, const QWidget * w, const QStyleOption &so, Q
if (sh == SH_Widget_ShareActivation) {
ceDataNotNeeded = true;
}
- QStyleControlElementData ceData = populateControlElementDataFromWidget(w, so, false, ceDataNotNeeded);
- return styleHint(sh, ceData, getControlElementFlagsForObject(w, ceData.widgetObjectTypes, QStyleOption(), false), so, shr, w);
+ const QStyleControlElementData &ceData = populateControlElementDataFromWidget(w, so, false, ceDataNotNeeded);
+ return styleHint(sh, ceData, getControlElementFlagsForObject(w, QStyleOption(), false), so, shr, w);
}
QPixmap QStyle::stylePixmap(StylePixmap sp, const QWidget *w, const QStyleOption &so) const
{
- QStyleControlElementData ceData = populateControlElementDataFromWidget(w, so);
- return stylePixmap(sp, ceData, getControlElementFlagsForObject(w, ceData.widgetObjectTypes, QStyleOption()), so, w);
+ const QStyleControlElementData &ceData = populateControlElementDataFromWidget(w, so);
+ return stylePixmap(sp, ceData, getControlElementFlagsForObject(w, QStyleOption()), so, w);
}
/*!
@@ -2830,4 +2832,8 @@ QStyleControlElementData::QStyleControlElementData() {
topLevelWidgetFlags = 0;
}
+QStyleControlElementData::~QStyleControlElementData() {
+ //
+}
+
#endif // QT_NO_STYLE