From 14dc38eea071c9144314b10a1892a987f111a72f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 11 Mar 2019 15:44:11 +0100 Subject: [PATCH] Remove dependency on Qt Mac Extras Change-Id: Id4d394974e87d7844c02c18f3c98957036503d7f Reviewed-by: Eike Ziller --- src/libs/utils/touchbar/touchbar.pri | 1 - src/libs/utils/touchbar/touchbar_mac.mm | 10 ++++++---- src/plugins/help/help.pro | 1 - src/plugins/help/macwebkithelpviewer.mm | 1 - 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/libs/utils/touchbar/touchbar.pri b/src/libs/utils/touchbar/touchbar.pri index 8d60ee423b4..5f185957857 100644 --- a/src/libs/utils/touchbar/touchbar.pri +++ b/src/libs/utils/touchbar/touchbar.pri @@ -9,7 +9,6 @@ macos { $$PWD/touchbar_mac.mm \ $$PWD/touchbar_appdelegate_mac.mm - QT += macextras LIBS += -framework Foundation -framework AppKit } else { SOURCES += $$PWD/touchbar.cpp diff --git a/src/libs/utils/touchbar/touchbar_mac.mm b/src/libs/utils/touchbar/touchbar_mac.mm index 67c83aec0ce..ee5a45bf720 100644 --- a/src/libs/utils/touchbar/touchbar_mac.mm +++ b/src/libs/utils/touchbar/touchbar_mac.mm @@ -29,8 +29,6 @@ #include -#include - #import #import #import @@ -145,8 +143,12 @@ static NSImage *iconToTemplateNSImage(const QIcon &icon) { // touch bar icons are max 18-22 pts big. our are always 22 pts big. const QPixmap pixmap = icon.pixmap(22); - NSImage *image = QtMac::toNSImage(pixmap); - // toNSImage ignores devicePixelRatio, so fixup after the fact + + CGImageRef cgImage = pixmap.toImage().toCGImage(); + NSImage *image = [[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize]; + CFRelease(cgImage); + + // The above code ignores devicePixelRatio, so fixup after the fact const CGFloat userWidth = pixmap.width() / pixmap.devicePixelRatio(); const CGFloat userHeight = pixmap.height() / pixmap.devicePixelRatio(); image.size = CGSizeMake(userWidth, userHeight); // scales the image diff --git a/src/plugins/help/help.pro b/src/plugins/help/help.pro index a9676630781..76c6db63a21 100644 --- a/src/plugins/help/help.pro +++ b/src/plugins/help/help.pro @@ -69,7 +69,6 @@ FORMS += docsettingspage.ui \ osx { DEFINES += QTC_MAC_NATIVE_HELPVIEWER - QT += macextras HEADERS += macwebkithelpviewer.h OBJECTIVE_SOURCES += macwebkithelpviewer.mm LIBS += -framework WebKit -framework AppKit diff --git a/src/plugins/help/macwebkithelpviewer.mm b/src/plugins/help/macwebkithelpviewer.mm index 1a7d561aeee..d0edb0e61c6 100644 --- a/src/plugins/help/macwebkithelpviewer.mm +++ b/src/plugins/help/macwebkithelpviewer.mm @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include