From 03b2346e4ec32fa11c3688d9d46616ab9b0448df Mon Sep 17 00:00:00 2001 From: Simone Gaiarin Date: Sat, 24 Oct 2020 16:34:28 +0200 Subject: [PATCH] Uncheck quick annotation when repopulating the quick tools menu This prevents undefined states when the currently selected quick annotation is modified or deleted in the annotation settings. BUG: 426026 FIXED-IN: 21.08 --- part/annotationactionhandler.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/part/annotationactionhandler.cpp b/part/annotationactionhandler.cpp index 802b6ed70..c671a8f1d 100644 --- a/part/annotationactionhandler.cpp +++ b/part/annotationactionhandler.cpp @@ -348,6 +348,11 @@ void AnnotationActionHandlerPrivate::populateQuickAnnotations() const QList numberKeys = {Qt::Key_1, Qt::Key_2, Qt::Key_3, Qt::Key_4, Qt::Key_5, Qt::Key_6, Qt::Key_7, Qt::Key_8, Qt::Key_9, Qt::Key_0}; + // to be safe and avoid undefined states of the currently selected quick annotation + if (isQuickToolAction(agTools->checkedAction())) { + q->deselectAllAnnotationActions(); + } + for (auto action : *quickTools) { action->setShortcut(QKeySequence()); aQuickTools->removeAction(action); @@ -383,7 +388,7 @@ void AnnotationActionHandlerPrivate::populateQuickAnnotations() favToolElement = annotator->quickTool(++favToolId); } - if (!quickTools->isEmpty() && !aQuickTools->defaultAction()) { + if (!quickTools->isEmpty()) { aQuickTools->setDefaultAction(quickTools->at(0)); } QAction *separator = new QAction();