In the end, I just created a little cocoa function to return this value to me. I use it to determine the paintEvent time whether to use hiDPI images. Works like a charm on my MacBook Pro 15 "Retina.
bool MYAppCocoaServices::isHiDPI(QWidget * widget) { NSView* view = reinterpret_cast<NSView*>(widget->winId()); CGFloat scaleFactor = 1.0; if ([[view window] respondsToSelector: @selector(backingScaleFactor)]) scaleFactor = [[view window] backingScaleFactor]; return (scaleFactor > 1.0); }
I create this .mm file conditionally only on Mac and call this static function from my C ++ code on Mac.
source share