Is there a "Window dirty" UI indicator?
-
On the mac, you can call
SetWindowModified()
to set a window's "dirty" bit, causig the red "close button" to get a dark dot in it, indicating "changed but not saved".Is there an API for that in Qt that works cross platform?
-
oh. i see. adding "[*]" to window title does not actually show up in the UI. well that's confusing.
setWindowModified()
should add that for you behind the scenes if necessary, the client shouldn't have to know about it. but okay, that works, thanks. -
https://stackoverflow.com/questions/31859008/qt-osx-system-window-close-button-state
Haven't tried it out, but according to this, it will work at least on Windows as well (Showing a " * " when file or window is modified).
Edit:
The " * " should appear even on Linux platforms.
QWidget Modified Window -
@Pl45m4 callig
setWindowModified(true)
does nothing on windows@MasterBLB what is the point of calling
setWindowModified()
on windows if it does nothing? IOW: if i'm going to have to manually manage whether the asterisk is shown, why bother calling that? -
Hi,
As explained in the property documentation, the "[*]" placeholder is to be put in the title so it will appear at that position when you call
setWindowModified(true)
. -
oh. i see. adding "[*]" to window title does not actually show up in the UI. well that's confusing.
setWindowModified()
should add that for you behind the scenes if necessary, the client shouldn't have to know about it. but okay, that works, thanks. -
@davecotter said in Is there a "Window dirty" UI indicator?:
@MasterBLB what is the point of calling
setWindowModified()
on windows if it does nothing? IOW: if i'm going to have to manually manage whether the asterisk is shown, why bother calling that?It does something - it sets internal flag windowModified. What you'll do with that flag it's up to you.
@davecotter said in Is there a "Window dirty" UI indicator?:
setWindowModified() should add that for you behind the scenes if necessary, the client shouldn't have to know about it.
Nope, it shouldn't - imagine someone wishes the flag state to be changed, but not window title. Besides, in QWidget documentation about windowTitle member you have explicitly mentioned how it works, and that placeholder may be added to window title.