From 1939cb02104d8e5ca0e4169e18b8e1f400090921 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 7 Nov 2017 16:37:12 +0700 Subject: QMacStyle: Make backingStoreNSView mutable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even thought the resolve function is effectively not const, it's more straightforward to call. Change-Id: I7c881183862c3c0b326daf001b2f9e569153ee76 Reviewed-by: Morten Johan Sørvig --- src/plugins/styles/mac/qmacstyle_mac.mm | 8 ++++---- src/plugins/styles/mac/qmacstyle_mac_p_p.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/plugins/styles/mac') 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(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(d)->resolveCurrentNSView(window); + d->resolveCurrentNSView(window); switch (ce) { case CE_HeaderSection: if (const QStyleOptionHeader *header = qstyleoption_cast(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(d)->resolveCurrentNSView(window); + d->resolveCurrentNSView(window); switch (cc) { case CC_ScrollBar: if (const QStyleOptionSlider *sb = qstyleoption_cast(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 focusWidget; QT_MANGLE_NAMESPACE(NotificationReceiver) *receiver; - NSView *backingStoreNSView; + mutable NSView *backingStoreNSView; mutable QHash cocoaControls; mutable QHash cocoaCells; -- cgit v1.2.3