I’m able to successfully access the QWebPage undoStack (QUndoStack) and obtain many of the undoStack parameters such as count, last index, and text as follows:
qDebug()<<"undo size: " <<page()->undoStack()->count();
int cindex = page()->undoStack()->index();
qDebug()<<"command name:"<<page()->undoStack()->text(cindex);
The problem I found was that that the text is always empty for common commands like cut or paste. I had hoped to fix this by setting the QUndoCommand text directly. For example:
page()->undoStack()->command(cindex)->setText(QString("cut"));
I thought this should work because I’m only using a const pointer but when I try it I get the error message:
passing ‘const QUndoCommand’ as ‘this’ argument of ‘void QUndoCommand::setText(const QString&)’ discards qualifiers
I have tried a number things to try and rename the command so I can see the undo sequence using QUndoView but none have been successful. Hopefully someone has a suggestion I can use.
↧