swiety
24th October 2007, 17:38
I have a QTreeWidget with rows:
A
B
C
D
and commands:
1:
QUndoStack *stack = new QUndoStack();
stack->push( new InsertCommand( new QTreeWidgetItem(), 0 ) );
stack->undo(); // insertTopLevelItem( 0, newitem );
Result:
NewItem
A
B
C
D
2:
InsertCommand *cmd = new InsertCommand( new QTreeWidgetItem(), 0 );
cmd->undo(); //insertTopLevelItem( 0, newitem );
Result:
NewItem
B
C
D
Why I have two different results. What's the difference between 1 and 2?
A
B
C
D
and commands:
1:
QUndoStack *stack = new QUndoStack();
stack->push( new InsertCommand( new QTreeWidgetItem(), 0 ) );
stack->undo(); // insertTopLevelItem( 0, newitem );
Result:
NewItem
A
B
C
D
2:
InsertCommand *cmd = new InsertCommand( new QTreeWidgetItem(), 0 );
cmd->undo(); //insertTopLevelItem( 0, newitem );
Result:
NewItem
B
C
D
Why I have two different results. What's the difference between 1 and 2?