Widgets are not updated - is this a bug?

Raymond Osborn rayosborn at mac.com
Thu Sep 17 13:04:36 BST 2020


The repaint issue has been a problem on Macs for a couple of years affecting PyQt5 since v5.11 at least. I am still on Mac OS 10.14. Here is a link to a Qt Forum post in 2018 - https://forum.qt.io/topic/98059/push-button-label-settext-not-refreshing-under-macos <https://forum.qt.io/topic/98059/push-button-label-settext-not-refreshing-under-macos>. I’m not sure if it affected Mac OS 10,13. It doesn’t affect PyQt 5.9. I have had to subclass most of the PyQt5 widgets that I use to add a repaint whenever they are updated programmatically.

Ray

> On Sep 17, 2020, at 4:12 AM, Phil Thompson <phil at riverbankcomputing.com> wrote:
> 
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200917/ab2dc0d4/attachment.htm>


More information about the PyQt mailing list