How to get "-- Edited" to show up on Mac window when document has unsaved changes?
Most resources online seems to suggest after setting the NSWindow::documentEdited property, the title should get the "-- Edited" (refer to TextEdit for the behavior) as well as the little dot on the close button. I can't seem to get the "-- Edited" to show up on my title after calling QMainWindow::setWindowModified(true). The close button does update correctly though. Has anyone managed to get that to work?
Looking a the method's documentation It seems you have to set the window title with
[*]that will be show when you set the property to true.
Hope it helps
We are already doing that, and it does display the asterisk when the document has unsaved changes, but not the "- Edited" like TextEdit or Script Editor does. Both of these apps display the "- Edited" instead of the little dot on the close button. Is this something Qt has control over?
Qt handles this on several levels however from a quick look at the code, it's QWidget's implementation that handles the title changes.
I cannot get the "- Edited" label to appear either.
Looking at the code, QCocoaWindow::setWindowModified is calling [NSWindow setDocumentEdited:YES] (https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/#//apple_ref/occ/instp/NSWindow/documentEdited). Is there anything else Qt is doing that might prevent this from working?
See the windowModified property