diff options
author | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2018-04-17 18:20:41 -0700 |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2018-04-19 22:20:12 +0000 |
commit | 7ee44dcb9c5c4ffaba0043d7d58e0d43ccc06195 (patch) | |
tree | 5a0e04dd7cd7b808f4885ede50339418863f169b /src/plugins/platforms/cocoa/qcocoacursor.mm | |
parent | 48defe41e1f6fb38800675922289dd7364fad8af (diff) |
Cocoa QPA: Clean up 0 as pointer
We use nil for Objective-C null pointers and nullptr everywhere
else, including CoreFoundation and similar opaque types.
Change-Id: Id75c59413dec54bf4d8e83cf7ed0ff7f3d8bb480
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoacursor.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoacursor.mm | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm index c021128e4c..b14cf6d3ee 100644 --- a/src/plugins/platforms/cocoa/qcocoacursor.mm +++ b/src/plugins/platforms/cocoa/qcocoacursor.mm @@ -80,15 +80,15 @@ void QCocoaCursor::setPos(const QPoint &position) pos.x = position.x(); pos.y = position.y(); - CGEventRef e = CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, kCGMouseButtonLeft); + CGEventRef e = CGEventCreateMouseEvent(nullptr, kCGEventMouseMoved, pos, kCGMouseButtonLeft); CGEventPost(kCGHIDEventTap, e); CFRelease(e); } NSCursor *QCocoaCursor::convertCursor(QCursor *cursor) { - if (cursor == nullptr) - return 0; + if (!cursor) + return nil; const Qt::CursorShape newShape = cursor->shape(); NSCursor *cocoaCursor; @@ -138,11 +138,11 @@ NSCursor *QCocoaCursor::convertCursor(QCursor *cursor) cocoaCursor = m_cursors.value(newShape); if (cocoaCursor && cursor->shape() == Qt::BitmapCursor) { [cocoaCursor release]; - cocoaCursor = 0; + cocoaCursor = nil; } - if (cocoaCursor == 0) { + if (!cocoaCursor) { cocoaCursor = createCursorData(cursor); - if (cocoaCursor == 0) + if (!cocoaCursor) return [NSCursor arrowCursor]; m_cursors.insert(newShape, cocoaCursor); @@ -211,8 +211,8 @@ NSCursor *QCocoaCursor::createCursorData(QCursor *cursor) 0x07, 0xf0, 0x0f, 0xf8, 0x0f, 0xf8, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0 }; #endif - const uchar *cursorData = 0; - const uchar *cursorMaskData = 0; + const uchar *cursorData = nullptr; + const uchar *cursorMaskData = nullptr; QPoint hotspot = cursor->hotSpot(); switch (cursor->shape()) { @@ -269,7 +269,7 @@ NSCursor *QCocoaCursor::createCursorData(QCursor *cursor) #endif default: qWarning("Qt: QCursor::update: Invalid cursor shape %d", cursor->shape()); - return 0; + return nil; } // Create an NSCursor from image data if this a self-provided cursor. @@ -279,7 +279,7 @@ NSCursor *QCocoaCursor::createCursorData(QCursor *cursor) return (createCursorFromBitmap(&bitmap, &mask, hotspot)); } - return 0; // should not happen, all cases covered above + return nil; // should not happen, all cases covered above } NSCursor *QCocoaCursor::createCursorFromBitmap(const QBitmap *bitmap, const QBitmap *mask, const QPoint hotspot) |