Widgets are not updated - is this a bug?

Raymond Osborn rayosborn at mac.com
Thu Sep 17 13:35:09 BST 2020


I only use whatever is built by Conda or pip. I’m not aware what they build against, but I had naively assumed there was some correspondence between PyQt5 and Qt5 versions. There is some version information here: https://bugreports.qt.io/browse/QTBUG-68740 <https://bugreports.qt.io/browse/QTBUG-68740> and https://bugreports.qt.io/browse/QTBUG-68521 <https://bugreports.qt.io/browse/QTBUG-68521>.

Ray

> On Sep 17, 2020, at 7:19 AM, Phil Thompson <phil at riverbankcomputing.com> wrote:
> 
> On 17/09/2020 13:04, Raymond Osborn wrote:
>> 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
> 
> To clarify, it's not the version of PyQt that is the problem, it is the version of Qt that PyQt is built against that is the problem.
> 
> Phil
> 
> 
>>> 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/b254b67d/attachment.htm>


More information about the PyQt mailing list