summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qwidgetlinecontrol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/widgets/qwidgetlinecontrol.cpp')
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index e6385ba390..7033eeea22 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -279,6 +279,23 @@ void QWidgetLineControl::clear()
separate();
finishChange(priorState, /*update*/false, /*edited*/false);
}
+/*!
+ \internal
+
+ Undoes the previous operation.
+*/
+
+void QWidgetLineControl::undo()
+{
+ // Undo works only for clearing the line when in any of password the modes
+ if (m_echoMode == QLineEdit::Normal) {
+ internalUndo();
+ finishChange(-1, true);
+ } else {
+ cancelPasswordEchoTimer();
+ clear();
+ }
+}
/*!
\internal
@@ -1278,12 +1295,6 @@ void QWidgetLineControl::internalUndo(int until)
cancelPasswordEchoTimer();
internalDeselect();
- // Undo works only for clearing the line when in any of password the modes
- if (m_echoMode != QLineEdit::Normal) {
- clear();
- return;
- }
-
while (m_undoState && m_undoState > until) {
Command& cmd = m_history[--m_undoState];
switch (cmd.type) {