![]() ![]() ![]() ('fusion')Īpp = YourQApplicationClassHere(sys.argv) So, to have your app sync color schemes with macOS' dark mode: # Must run before QApplication is instantiated, otherwise certain widget styles will remain unset setStyle() must be called with a string argument.This is in addition to the setStyle() call before instantiating your QApplication, for a total of two setStyle()s. You must call setStyle() after you've instantiated your QApplication.There are two rules to make the setStyle() trick work: Why it is that color scheme changes don't apply until setStyle() is called, I have no idea. (You can see this if you call tPalette(palette) with a custom palette some colors will change and others won't-until setStyle() is called, upon which all colors finally change.) I can only speculate that dark mode was detected on app start but not activated. You have to call tStyle('style name here').įor whatever reason, it seems that any color scheme changes lay inert until "activated" by setStyle(). I struggled with this problem myself (PyQt5 5.14) and have figured out how to make macOS' dark mode work with PyQt5. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |