[Interest] surprising interaction between setWindowModified, setWindowTitle and style on Mac

René J.V. Bertin rjvbertin at gmail.com
Wed Aug 28 19:05:45 CEST 2019


Hi,

Has anyone noticed a surprising interaction between the (set)WindowModified() feature, setWindowTitle() and the style in use, on Mac?

I do not yet understand it perfectly myself, but in a rough outline, if you

1) call setWindowModified(true) and then
2) change the title with setWindowTitle() (to something including the [*] placeholder) and then
3) some time later call setWindowModified(false)

the window close button will start (2) and stop (3) showing the modification indicator, but the title will start to show the * indicator in 2) and NOT remove it in 3), until you actually change the title again.

This happens when using a cross-platform style, i.e. one which returns true for SH_TitleBar_ModifyNotification, like for instance Qt's own Fusion style.
It is also linked somehow to the QPA in use: I can induce this with the Cocoa platform plugin, but not when I use the XCB plugin (still on Mac, of course).

The issue depends on the order above, and won't show if you do any title changes before changing the windowModified property. In itself that seems logical enough for me but I haven't yet made up my mind if this call order dependency has "bug" written over it or not.

I've added a little demonstrator to github:RJVB/fontweightissue-qt5.git . I can trigger the issue by

1) start the app (using `-style fusion`)
2) select a different font: close button and titlebar will show windowModified=true
3) select the same font: the close button will show windowModified=false but the titlebar will continue to show a *

(the last selected font is restored on startup so you may need to start and stop it once just to bootstrap it)


For me this works with Qt 5.8 and 5.9.8, I cannot test with newer Qt versions on Mac for now.

R.



More information about the Interest mailing list