Widgets are not updated - is this a bug?

Phil Thompson phil at riverbankcomputing.com
Thu Sep 17 10:12:30 BST 2020


On 17/09/2020 09:46, Jeremy Katz wrote:
> On 17/Sep/20 01:08, Jeremy Katz wrote:
>> On 15/Sep/20 06:29, Phil Thompson wrote:
>> 
>> [...]
>>> 
>>> However I am currently at a loss about what is happening. I am using 
>>> a
>>> version of PyQt that only uses "plain" Qt classes which does not 
>>> allow
>>> Python re-implementations of C++ virtuals. This means that while the 
>>> Qt
>>> event loop is running (ie. in the call to exec()), *no* PyQt is 
>>> executed
>>> - yet the problem still exists. It's almost as if the very presence 
>>> of
>>> Python is having an effect.
>>> 
>>> Any insight would be welcome...
>>> 
>>> Phil
>> 
>> 
>> Short version:
>> 
>> Setting the environment variable QT_MAC_WANTS_LAYER to 1 may fix the
>> issue for macOS 10.15. The code at
>> https://code.woboq.org/qt5/qtbase/src/plugins/platforms/cocoa/qnsview_drawing.mm.html#108
>> indicates this won't work for 10.14.
> 
> Setting the style with QApplication.setStyle() or the command line
> -style option also works. Both the fusion and windows styles function 
> as
> expected. Explicitly using the macintosh style results in the rendering
> defect. I still don't know how the dark mode mac style is invoked, or
> why it works while the light mode style does not.

Setting QT_MAC_WANTS_LAYER or using fusion both work for me. Building 
against Qt v5.9 also works.

Whether this is a genuine Qt bug, or just an unresolved clash between Qt 
and Python settings on macOS is difficult to say.

Setting QT_MAC_WANTS_LAYER in the PyQt initialisation seems a reasonable 
workaround.

Does anybody know if the problems exists on macOS 10.14 and earlier?

Phil


More information about the PyQt mailing list