summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNorwegian Rock Cat <qt-info@nokia.com>2009-05-18 13:40:51 (GMT)
committerNorwegian Rock Cat <qt-info@nokia.com>2009-05-18 14:00:15 (GMT)
commitef310a8cf2067a2fe21d6812cf34fb8aaad74f48 (patch)
tree2c22cc2afafdec55e58012abfd907777f00d8030 /src
parent5c25207628fbcc94e92b129ac7660af14613ad85 (diff)
downloadQt-ef310a8cf2067a2fe21d6812cf34fb8aaad74f48.zip
Qt-ef310a8cf2067a2fe21d6812cf34fb8aaad74f48.tar.gz
Qt-ef310a8cf2067a2fe21d6812cf34fb8aaad74f48.tar.bz2
Prevent a crash with brushed metal windows and a qApp style sheet
My great metal hack simply needs to hack more and not do the "extra" assign since I'm doing this through a back door in set attribute. We probably should have had the brushed metal go via an actual QStyle subclass instead of through the attribute. Task-number: 253448 Reviewed-by: ogoffart
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qwidget.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index d911b48..4cb9380 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -2343,13 +2343,26 @@ void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate, bool
)
{
Q_Q(QWidget);
- createExtra();
-
QStyle *oldStyle = q->style();
#ifndef QT_NO_STYLE_STYLESHEET
- QStyle *origStyle = extra->style;
+ QStyle *origStyle = 0;
+#endif
+
+#ifdef Q_WS_MAC
+ // the metalhack boolean allows Qt/Mac to do a proper re-polish depending
+ // on how the Qt::WA_MacBrushedMetal attribute is set. It is only ever
+ // set when changing that attribute and passes the widget's CURRENT style.
+ // therefore no need to do a reassignment.
+ if (!metalHack)
#endif
- extra->style = newStyle;
+ {
+ createExtra();
+
+#ifndef QT_NO_STYLE_STYLESHEET
+ origStyle = extra->style;
+#endif
+ extra->style = newStyle;
+ }
// repolish
if (q->windowType() != Qt::Desktop) {