“Clean” and “clear” are separate but related classes of states.
The clean state has getter isClean() and setter setClean().
The clear state has getter: count() <= 0, and setter clear(). (The getter method is not defined by Qt, but let’s name it “isClear”.)
“isClean” does not imply “isClear”. A clean undo stack may still have commands that can be redone/undone.
“isClear” implies “isClean.” A clear undo stack does not have any commands on it.
Typically, when you save a document (or open an existing one), you call clear(). At that point, your app behaves just as if the user newly opened the document: there is nothing to undo or redo.
Subsequently, if the user does something, but undoes it, the document is “clean”. That is, in the same condition as is saved. Typically, an app shows the unclean state in the title bar, for example by an asterisk in front of the document name.