diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-03-09 18:43:52 +0100 |
---|---|---|
committer | Tor Arne Vestbø <torarnv@gmail.com> | 2020-03-12 11:49:08 +0100 |
commit | bee3d0fc1310da6685dce9cf9b1334fb8295aa9a (patch) | |
tree | ec5965fda8d2285d42649a39162ca0b3704f1858 /src/gui/painting/qcoregraphics_p.h | |
parent | 52e9c8b4be6718bda1a46859d6b1c13664c57c2a (diff) |
macOS: Streamline QIcon to NSImage conversion
The conversion uses NSBitmapImageRep and correctly sets the display
pixel ratio and size of the resulting image, reducing the need for
clients to deal with this.
It also propagates the isMask property of the icon to the NSImage.
The function returns an auto-released object, as is customary for
class-functions like these.
Change-Id: If97f3d383959cd0f58a0d1249f5c26e52c1da9cd
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/gui/painting/qcoregraphics_p.h')
-rw-r--r-- | src/gui/painting/qcoregraphics_p.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/painting/qcoregraphics_p.h b/src/gui/painting/qcoregraphics_p.h index e1697b0f38..db012d3cda 100644 --- a/src/gui/painting/qcoregraphics_p.h +++ b/src/gui/painting/qcoregraphics_p.h @@ -69,12 +69,13 @@ QT_BEGIN_NAMESPACE Q_GUI_EXPORT CGBitmapInfo qt_mac_bitmapInfoForImage(const QImage &image); #ifdef HAVE_APPKIT -Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize = 0); Q_GUI_EXPORT QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size); QT_END_NAMESPACE @interface NSImage (QtExtras) + (instancetype)imageFromQImage:(const QT_PREPEND_NAMESPACE(QImage) &)image; ++ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon; ++ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon withSize:(int)size; @end QT_BEGIN_NAMESPACE |