summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-11-07 16:37:12 +0700
committerGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-11-15 19:05:15 +0000
commit1939cb02104d8e5ca0e4169e18b8e1f400090921 (patch)
tree919e017c0904166e148dd594aa0b7421e146e2e2
parent9af0601fd91d9a0fa6266e978c8b742a38140b7f (diff)
QMacStyle: Make backingStoreNSView mutable
Even thought the resolve function is effectively not const, it's more straightforward to call. Change-Id: I7c881183862c3c0b326daf001b2f9e569153ee76 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm8
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac_p_p.h4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index a8cb361969..c7f573cc08 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -2058,7 +2058,7 @@ void QMacStylePrivate::drawNSViewInRect(CocoaControl widget, NSView *view, const
restoreNSGraphicsContext(ctx);
}
-void QMacStylePrivate::resolveCurrentNSView(QWindow *window)
+void QMacStylePrivate::resolveCurrentNSView(QWindow *window) const
{
backingStoreNSView = window ? (NSView *)window->winId() : nil;
}
@@ -3095,7 +3095,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
QMacCGContext cg(p);
QWindow *window = w && w->window() ? w->window()->windowHandle() :
QStyleHelper::styleObjectWindow(opt->styleObject);
- const_cast<QMacStylePrivate *>(d)->resolveCurrentNSView(window);
+ d->resolveCurrentNSView(window);
switch (pe) {
case PE_IndicatorArrowUp:
case PE_IndicatorArrowDown:
@@ -3593,7 +3593,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
QMacCGContext cg(p);
QWindow *window = w && w->window() ? w->window()->windowHandle() :
QStyleHelper::styleObjectWindow(opt->styleObject);
- const_cast<QMacStylePrivate *>(d)->resolveCurrentNSView(window);
+ d->resolveCurrentNSView(window);
switch (ce) {
case CE_HeaderSection:
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
@@ -5126,7 +5126,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
QMacCGContext cg(p);
QWindow *window = widget && widget->window() ? widget->window()->windowHandle() :
QStyleHelper::styleObjectWindow(opt->styleObject);
- const_cast<QMacStylePrivate *>(d)->resolveCurrentNSView(window);
+ d->resolveCurrentNSView(window);
switch (cc) {
case CC_ScrollBar:
if (const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
diff --git a/src/plugins/styles/mac/qmacstyle_mac_p_p.h b/src/plugins/styles/mac/qmacstyle_mac_p_p.h
index 01b0a15427..045753989f 100644
--- a/src/plugins/styles/mac/qmacstyle_mac_p_p.h
+++ b/src/plugins/styles/mac/qmacstyle_mac_p_p.h
@@ -269,7 +269,7 @@ public:
void setupVerticalInvertedXform(CGContextRef cg, bool reverse, bool vertical, const CGRect &rect) const;
void drawNSViewInRect(CocoaControl widget, NSView *view, const QRect &rect, QPainter *p, bool isQWidget = true, DrawRectBlock drawRectBlock = nil) const;
- void resolveCurrentNSView(QWindow *window);
+ void resolveCurrentNSView(QWindow *window) const;
void drawFocusRing(QPainter *p, const QRect &targetRect, int hMargin, int vMargin, qreal radius = 0) const;
@@ -283,7 +283,7 @@ public:
mutable QPointer<QFocusFrame> focusWidget;
QT_MANGLE_NAMESPACE(NotificationReceiver) *receiver;
- NSView *backingStoreNSView;
+ mutable NSView *backingStoreNSView;
mutable QHash<CocoaControl, NSView *> cocoaControls;
mutable QHash<CocoaControl, NSCell *> cocoaCells;