[PyQt] how to support dark mode?

Marko Luther marko.luther at gmx.net
Fri Dec 20 09:18:25 GMT 2019


Dear all,

did anybody manage to build an app that takes advantage of the automatic dark mode support in recent Qt versions on macOS.

For pip PyQt 5.13.1 adding

	<key>NSRequiresAquaSystemAppearance</key>
	<string>false</string>

to the Info.plist worked for app.bundles build with either py2app or pyinstaller, but fails on using PyQt 5.13.2 and 5.14.0 running on macOS 10.15.2 with the system message

> It does not make sense to draw an image when [NSGraphicsContext currentContext] is nil.  This is a programming error. Break on void _NSWarnForDrawingImageWithNoCurrentContext(void) to debug.  This will be logged only once.  This may break in the future.

What changed between 5.13.1 and 5.13.2/5.14.0?

Without the above Info.plist entry the PyQt dialogs are never rendered in Qt's dark theme. Is there any way to have the PyQt dialogs rendered with the default Qt dark theme for apps running under macOS dark mode?

Thanks for any hint,
Marko


More information about the PyQt mailing list