summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTamás Martinec <tamas.martinec@symbio.com>2021-05-04 13:49:18 +0300
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-05-05 13:42:26 +0000
commit0eaf920983ea9006f3fe26d1bdf104e63984d689 (patch)
tree23109beb8a42a90b2ffc559d3fba665adaacb087 /src
parent975a059a3eea0d12fec483d62bdc397f6f066700 (diff)
iOS: Keep undo/redo widgets enabled on the undo shortcut bar after undo
Having two undo/redo operations on the rebuilt undo stack always enables the undo/redo widgets on the shorcut bar. This might be more desirable than the current behavior that only allows one undo from the shortcut bar. Fixes: QTBUG-63393 Change-Id: I2c99f27895def47b58534035461ceb7b4e5c3057 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 3b155973c494e847b821f0b5675a061f4e424a6c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.mm15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm
index 5d32f218fc..0cc8c0ec54 100644
--- a/src/plugins/platforms/ios/qiostextresponder.mm
+++ b/src/plugins/platforms/ios/qiostextresponder.mm
@@ -514,15 +514,23 @@
// from within a undo callback.
NSUndoManager *undoMgr = self.undoManager;
[undoMgr removeAllActions];
+
+ [undoMgr beginUndoGrouping];
+ [undoMgr registerUndoWithTarget:self selector:@selector(undo) object:nil];
+ [undoMgr endUndoGrouping];
[undoMgr beginUndoGrouping];
[undoMgr registerUndoWithTarget:self selector:@selector(undo) object:nil];
[undoMgr endUndoGrouping];
- // Schedule an operation that we immediately pop off to be able to schedule a redo
+ // Schedule operations that we immediately pop off to be able to schedule redos
+ [undoMgr beginUndoGrouping];
+ [undoMgr registerUndoWithTarget:self selector:@selector(registerRedo) object:nil];
+ [undoMgr endUndoGrouping];
[undoMgr beginUndoGrouping];
[undoMgr registerUndoWithTarget:self selector:@selector(registerRedo) object:nil];
[undoMgr endUndoGrouping];
[undoMgr undo];
+ [undoMgr undo];
// Note that, perhaps because of a bug in UIKit, the buttons on the shortcuts bar ends up
// disabled if a undo/redo callback doesn't lead to a [UITextInputDelegate textDidChange].
@@ -530,6 +538,11 @@
// become disabled when there is nothing more to undo (Qt didn't change anything upon receiving
// an undo request). This seems to be OK behavior, so we let it stay like that unless it shows
// to cause problems.
+
+ // QTBUG-63393: Having two operations on the rebuilt undo stack keeps the undo/redo widgets
+ // always enabled on the shortcut bar. This workaround was found by experimenting with
+ // removing the removeAllActions call, and is related to the unknown internal implementation
+ // details of how the shortcut bar updates the dimming of its buttons.
});
}