@@ -61,13 +61,15 @@ void QgsUndoWidget::destroyStack()
61
61
{
62
62
if ( mUndoStack != NULL )
63
63
{
64
- mUndoStack -> clear ();
64
+ // do not clear undo stack here, just null pointer
65
65
mUndoStack = NULL ;
66
66
}
67
67
if ( mUndoView != NULL )
68
68
{
69
69
mUndoView ->close ();
70
- mUndoView = NULL ;
70
+ delete mUndoView ;
71
+ mUndoView = new QUndoView ( dockWidgetContents );
72
+ gridLayout->addWidget ( mUndoView , 0 , 0 , 1 , 2 );
71
73
}
72
74
}
73
75
@@ -99,23 +101,24 @@ void QgsUndoWidget::indexChanged( int curIndx )
99
101
// when individually redoing, differentiate between last redo and a new command added to stack
100
102
bool lastRedo = ( mPreviousIndex == ( mPreviousCount - 1 ) && mPreviousCount == curCount && !canRedo );
101
103
102
- bool debugThis = false ;
103
- if ( debugThis && offset != 0 )
104
+ if ( offset != 0 )
104
105
{
105
- // '= Rendering =' text is for filtering log results to also only show canvas rendering event
106
- QgsDebugMsg ( QString ( " = Rendering = curIndx : %1" ).arg ( curIndx ) );
107
- QgsDebugMsg ( QString ( " = Rendering = offset : %1" ).arg ( offset ) );
108
- QgsDebugMsg ( QString ( " = Rendering = curCount: %1" ).arg ( curCount ) );
106
+ QgsDebugMsg ( QString ( " curIndx : %1" ).arg ( curIndx ) );
107
+ QgsDebugMsg ( QString ( " offset : %1" ).arg ( offset ) );
108
+ QgsDebugMsg ( QString ( " curCount: %1" ).arg ( curCount ) );
109
109
if ( lastRedo )
110
- QgsDebugMsg ( QString ( " = Rendering = lastRedo: true" ) );
110
+ QgsDebugMsg ( QString ( " lastRedo: true" ) );
111
111
}
112
112
113
- // avoid canvas refresh when only a command was added to stack (i.e. no user undo/redo action)
114
- // or when user has clicked back in view history then added a new command to the stack
113
+ // avoid canvas redraws when only new command was added to stack (i.e. no user undo/redo action)
114
+ // or when user has clicked back in QUndoView history then added a new command to the stack
115
115
if ( offset > 1 || ( offset == 1 && ( canRedo || lastRedo ) ) )
116
116
{
117
117
if ( mMapCanvas )
118
+ {
119
+ QgsDebugMsg ( QString ( " trigger redraw" ) );
118
120
mMapCanvas ->refresh ();
121
+ }
119
122
}
120
123
121
124
mPreviousIndex = curIndx;
0 commit comments