diff --git a/ui/annotationactionhandler.cpp b/ui/annotationactionhandler.cpp index 07f9247b9..ca072f5b5 100644 --- a/ui/annotationactionhandler.cpp +++ b/ui/annotationactionhandler.cpp @@ -43,8 +43,6 @@ public: explicit AnnotationActionHandlerPrivate(AnnotationActionHandler *qq) : q(qq) , annotator(nullptr) - , textTools(nullptr) - , textQuickTools(nullptr) , agTools(nullptr) , agLastAction(nullptr) , aQuickTools(nullptr) @@ -103,8 +101,8 @@ public: PageViewAnnotator *annotator; - QList *textTools; - QList *textQuickTools; + QList textTools; + QList textQuickTools; QActionGroup *agTools; QAction *agLastAction; @@ -341,7 +339,7 @@ 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}; - textQuickTools->clear(); + textQuickTools.clear(); aQuickTools->removeAllActions(); int favToolId = 1; @@ -361,7 +359,7 @@ void AnnotationActionHandlerPrivate::populateQuickAnnotations() QDomElement engineElement = favToolElement.firstChildElement(QStringLiteral("engine")); if (engineElement.attribute(QStringLiteral("type")) == QStringLiteral("TextSelector")) { - textQuickTools->append(annFav); + textQuickTools.append(annFav); annFav->setEnabled(textToolsEnabled); } @@ -559,12 +557,10 @@ AnnotationActionHandler::AnnotationActionHandler(PageViewAnnotator *parent, KAct d->agTools->addAction(aEllipse); d->agTools->addAction(aPolygon); - d->textQuickTools = new QList(); - d->textTools = new QList(); - d->textTools->append(aHighlighter); - d->textTools->append(aUnderline); - d->textTools->append(aSquiggle); - d->textTools->append(aStrikeout); + d->textTools.append(aHighlighter); + d->textTools.append(aUnderline); + d->textTools.append(aSquiggle); + d->textTools.append(aStrikeout); int toolId = 1; const QList tools = d->agTools->actions(); @@ -751,10 +747,10 @@ void AnnotationActionHandler::setToolsEnabled(bool on) void AnnotationActionHandler::setTextToolsEnabled(bool on) { d->textToolsEnabled = on; - for (QAction *ann : qAsConst(*d->textTools)) { + for (QAction *ann : qAsConst(d->textTools)) { ann->setEnabled(on); } - for (QAction *ann : qAsConst(*d->textQuickTools)) { + for (QAction *ann : qAsConst(d->textQuickTools)) { ann->setEnabled(on); } } diff --git a/ui/pageviewannotator.cpp b/ui/pageviewannotator.cpp index e0f00c893..3b37ec58a 100644 --- a/ui/pageviewannotator.cpp +++ b/ui/pageviewannotator.cpp @@ -772,6 +772,8 @@ void PageViewAnnotator::reparseQuickToolsConfig() PageViewAnnotator::~PageViewAnnotator() { delete m_engine; + delete m_builtinToolsDefinition; + delete m_quickToolsDefinition; } bool PageViewAnnotator::active() const