From a996019a764a6e36cbe6a11ec4d6b04b1c9c3137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Tue, 11 Dec 2018 12:21:47 +0100 Subject: [PATCH] #3837 Annotations. Fix non working create text annotation command --- .../RicCreateTextAnnotationFeature.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/Commands/AnnotationCommands/RicCreateTextAnnotationFeature.cpp b/ApplicationCode/Commands/AnnotationCommands/RicCreateTextAnnotationFeature.cpp index c4c43cf438..f07b7c1f27 100644 --- a/ApplicationCode/Commands/AnnotationCommands/RicCreateTextAnnotationFeature.cpp +++ b/ApplicationCode/Commands/AnnotationCommands/RicCreateTextAnnotationFeature.cpp @@ -82,6 +82,14 @@ void RicCreateTextAnnotationFeature::setupActionLook(QAction* actionToSetup) //-------------------------------------------------------------------------------------------------- RimAnnotationCollectionBase* RicCreateTextAnnotationFeature::annotationCollectionBase() const { - auto selObjs = caf::selectedObjectsByTypeStrict(); - return selObjs.size() == 1 ? selObjs.front() : nullptr; + auto selColls = caf::selectedObjectsByTypeStrict(); + if (selColls.size() == 1) return selColls.front(); + + RimAnnotationCollectionBase* coll; + auto selGroupColl = caf::selectedObjectsByTypeStrict(); + if (selGroupColl.size() == 1) + { + selGroupColl.front()->firstAncestorOrThisOfType(coll); + } + return coll; }