本文整理汇总了C++中CommandManager::undo方法的典型用法代码示例。如果您正苦于以下问题:C++ CommandManager::undo方法的具体用法?C++ CommandManager::undo怎么用?C++ CommandManager::undo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandManager
的用法示例。
在下文中一共展示了CommandManager::undo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[]){
/* simple test on CommandManager */
CommandManager cmdMan ;
IUndoRedoCommand* addCmd1 = new AddCommand(2,"AddCommand1(+2)",cmdMan.getSomme());
IUndoRedoCommand* dltCmd1 = new DeleteCommand(4,"DeleteCommand1(-4)",cmdMan.getSomme());
IUndoRedoCommand* addCmd2 = new AddCommand(20,"AddCommand2(+20)",cmdMan.getSomme());
IUndoRedoCommand* dltCmd2 = new DeleteCommand(1,"DeleteCommand2(-1)",cmdMan.getSomme());
std::cout << cmdMan.getSomme().getSommeValue() << std::endl;
cmdMan.pushNewCommand(addCmd1);
cmdMan.pushNewCommand(dltCmd1);
cmdMan.pushNewCommand(addCmd2);
std::cout << cmdMan.getSomme().getSommeValue() << std::endl;
cmdMan.undo();
std::cout << cmdMan.getSomme().getSommeValue() << std::endl;
cmdMan.pushNewCommand(dltCmd2);
std::cout << cmdMan.getSomme().getSommeValue() << std::endl;
std::cout << "It's gonna undooooing" << std::endl;
for(int i = 0; i <3;++i) cmdMan.undo();
std::cout << cmdMan.getSomme().getSommeValue() << std::endl;
std::cout << "It's gonna redooooing" << std::endl;
for(int i = 0; i <3;++i) cmdMan.redo();
std::cout << cmdMan.getSomme().getSommeValue() << std::endl;
QApplication app(argc, argv);
UndoView* undoView = new UndoView(&cmdMan);
QWidget * undoWidget = new UndoWidget(undoView);
undoWidget->setWindowTitle("Command List");
undoWidget->show();
return app.exec();
//return EXIT_SUCCESS;
}