diff options
author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2013-07-02 15:21:07 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-02 16:33:08 +0200 |
commit | 323164f5fbfbd56c1a0c2d856e440a87b0ed73c7 (patch) | |
tree | 18979a8cce6e0edc6b56347007e48b186166556e /src/plugins/platforms | |
parent | fa1fb5ed945650d45cf9b61906232cfbae11360e (diff) |
Avoid warnings when fetching file icons without a CGContextRef
This can happen when instantiating a QFileIconProvider and no suitable
graphics context is available (e.g., when only using a QQuickView).
The proper, longer (5.2) term solution would be to have the platform theme
return a QIcon with a NSImage icon provider.
Task-number: QTBUG-31908
Change-Id: Ibfdb51e0a7dd2c33761a463f4eb6619f0aca19f0
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoatheme.mm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 9c10bc26dd..13a387a0a3 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -258,8 +258,9 @@ QPixmap QCocoaTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &siz return QPixmap(); NSRect iconRect = NSMakeRect(0, 0, size.width(), size.height()); + NSGraphicsContext *gc = [NSGraphicsContext currentContext]; CGImageRef cgImage = [iconImage CGImageForProposedRect:&iconRect - context:[NSGraphicsContext currentContext] + context:([gc graphicsPort] ? gc : nil) hints:nil]; QPixmap pixmap = QPixmap::fromImage(qt_mac_toQImage(cgImage)); return pixmap; |