diff --git src/gui/painting/qpaintengine_mac.cpp src/gui/painting/qpaintengine_mac.cpp
index 4aa0668..05c2d18 100644
--- src/gui/painting/qpaintengine_mac.cpp
+++ src/gui/painting/qpaintengine_mac.cpp
@@ -289,7 +289,7 @@ static CGMutablePathRef qt_mac_compose_path(const QPainterPath &p, float off=0)
 }
 
 CGColorSpaceRef QCoreGraphicsPaintEngine::m_genericColorSpace = 0;
-QHash<QWidget*, CGColorSpaceRef> QCoreGraphicsPaintEngine::m_displayColorSpaceHash; // window -> color space
+QHash<CGDirectDisplayID, CGColorSpaceRef> QCoreGraphicsPaintEngine::m_displayColorSpaceHash;
 bool QCoreGraphicsPaintEngine::m_postRoutineRegistered = false;
 
 CGColorSpaceRef QCoreGraphicsPaintEngine::macGenericColorSpace()
@@ -320,46 +320,36 @@ CGColorSpaceRef QCoreGraphicsPaintEngine::macDisplayColorSpace(const QWidget *wi
 {
     // The color space depends on which screen the widget's window is on.
     // widget == 0 is a spacial case where we use the main display.
-    QWidget *window = widget ? widget->window() : 0;
+    // This code has been patched for 10.11 compatibility
+    CGColorSpaceRef colorSpace;
 
-    // Check for cached color space and return if found.
-    if (m_displayColorSpaceHash.contains(window))
-        return m_displayColorSpaceHash.value(window);
-
-    // Find which display the window is on.
     CGDirectDisplayID displayID;
-    if (window == 0) {
+    if (widget == 0) {
         displayID = CGMainDisplayID();
     } else {
-        const QRect &qrect = window->geometry();
+        // Find which display the window is on.
+        const QRect &qrect = widget->window()->geometry();
         CGRect rect = CGRectMake(qrect.x(), qrect.y(), qrect.width(), qrect.height());
         CGDisplayCount throwAway;
         CGDisplayErr dErr = CGGetDisplaysWithRect(rect, 1, &displayID, &throwAway);
         if (dErr != kCGErrorSuccess)
-            displayID = CGMainDisplayID();
-    }
-
-    // Get the color space from the display profile.
-    CGColorSpaceRef colorSpace = 0;
-    CMProfileRef displayProfile = 0;
-    CMError err = CMGetProfileByAVID((CMDisplayIDType)displayID, &displayProfile);
-    if (err == noErr) {
-        colorSpace = CGColorSpaceCreateWithPlatformColorSpace(displayProfile);
-        CMCloseProfile(displayProfile);
+            return macDisplayColorSpace(0); // fall back on main display
     }
+    if ((colorSpace = m_displayColorSpaceHash.value(displayID)))
+        return colorSpace;
 
+    colorSpace = CGDisplayCopyColorSpace(displayID);
     // Fallback: use generic DeviceRGB
     if (colorSpace == 0)
         colorSpace = CGColorSpaceCreateDeviceRGB();
 
+    // cache the result
+    m_displayColorSpaceHash.insert(displayID, colorSpace);
     // Install cleanup routines
     if (!m_postRoutineRegistered) {
         m_postRoutineRegistered = true;
         qAddPostRoutine(QCoreGraphicsPaintEngine::cleanUpMacColorSpaces);
     }
-
-    // Cache and return.
-    m_displayColorSpaceHash.insert(window, colorSpace);
     return colorSpace;
 }
 
@@ -369,7 +359,7 @@ void QCoreGraphicsPaintEngine::cleanUpMacColorSpaces()
         CFRelease(m_genericColorSpace);
         m_genericColorSpace = 0;
     }
-    QHash<QWidget*, CGColorSpaceRef>::const_iterator it = m_displayColorSpaceHash.constBegin();
+    QHash<CGDirectDisplayID, CGColorSpaceRef>::const_iterator it = m_displayColorSpaceHash.constBegin();
     while (it != m_displayColorSpaceHash.constEnd()) {
         if (it.value())
             CFRelease(it.value());
@@ -1069,7 +1059,16 @@ void QCoreGraphicsPaintEngine::cleanup()
 
 void QCoreGraphicsPaintEngine::clearColorSpace(QWidget* w)
 {
-    m_displayColorSpaceHash.remove(w);
+    CGDirectDisplayID displayID = CGMainDisplayID();
+    if (w != 0) {
+        const QRect &qrect = w->window()->geometry();
+        CGRect rect = CGRectMake(qrect.x(), qrect.y(), qrect.width(), qrect.height());
+        CGDisplayCount throwAway;
+        CGDisplayErr dErr = CGGetDisplaysWithRect(rect, 1, &displayID, &throwAway);
+        if (dErr != kCGErrorSuccess)
+      displayID = CGMainDisplayID();
+    }
+    m_displayColorSpaceHash.remove(displayID);
 }
 
 CGContextRef
diff --git src/gui/painting/qpaintengine_mac_p.h src/gui/painting/qpaintengine_mac_p.h
index 0f935c9..359826c 100644
--- src/gui/painting/qpaintengine_mac_p.h
+++ src/gui/painting/qpaintengine_mac_p.h
@@ -135,7 +135,7 @@ protected:
 private:
     static bool m_postRoutineRegistered;
     static CGColorSpaceRef m_genericColorSpace;
-    static QHash<QWidget*, CGColorSpaceRef> m_displayColorSpaceHash; // window -> color space
+    static QHash<CGDirectDisplayID, CGColorSpaceRef> m_displayColorSpaceHash; // Display (was window) -> color space
     static void cleanUpMacColorSpaces();
     Q_DISABLE_COPY(QCoreGraphicsPaintEngine)
 };
