summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoahelpers.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoahelpers.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 606b2e7032..7cf8fb7a83 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -181,13 +181,16 @@ NSImage *qt_mac_create_nsimage(const QPixmap &pm)
return nsImage;
}
-NSImage *qt_mac_create_nsimage(const QIcon &icon)
+NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize)
{
if (icon.isNull())
return nil;
NSImage *nsImage = [[NSImage alloc] init];
- foreach (QSize size, icon.availableSizes()) {
+ QList<QSize> availableSizes = icon.availableSizes();
+ if (availableSizes.isEmpty() && defaultSize > 0)
+ availableSizes << QSize(defaultSize, defaultSize);
+ foreach (QSize size, availableSizes) {
QPixmap pm = icon.pixmap(size);
QImage image = pm.toImage();
CGImageRef cgImage = qt_mac_toCGImage(image);