2
0
Эх сурвалжийг харах

Merge pull request #2322 from aws-lumberyard-dev/hultonha_LYN-1866_viewport-ui-focus-tidy

ViewportUi related tidy-up changes
hultonha 4 жил өмнө
parent
commit
231f09d899
21 өөрчлөгдсөн 179 нэмэгдсэн , 189 устгасан
  1. 0 1
      Code/Editor/ShortcutDispatcher.cpp
  2. 0 1
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/Button.cpp
  3. 2 2
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/Button.h
  4. 4 3
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ButtonGroup.cpp
  5. 2 2
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ButtonGroup.h
  6. 1 3
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/TextField.cpp
  7. 4 3
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/TextField.h
  8. 25 18
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiCluster.cpp
  9. 4 5
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiCluster.h
  10. 42 73
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiDisplay.cpp
  11. 18 18
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiDisplay.h
  12. 10 7
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiDisplayLayout.cpp
  13. 3 3
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiDisplayLayout.h
  14. 9 15
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiManager.cpp
  15. 1 1
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiManager.h
  16. 17 6
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiSwitcher.cpp
  17. 2 2
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiSwitcher.h
  18. 13 7
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiTextField.cpp
  19. 8 8
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiTextField.h
  20. 3 6
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiWidgetCallbacks.cpp
  21. 11 5
      Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiWidgetCallbacks.h

+ 0 - 1
Code/Editor/ShortcutDispatcher.cpp

@@ -346,7 +346,6 @@ bool ShortcutDispatcher::eventFilter(QObject* obj, QEvent* ev)
 
     case QEvent::Shortcut:
         return shortcutFilter(obj, static_cast<QShortcutEvent*>(ev));
-        break;
 
     case QEvent::MouseButtonPress:
         if (!s_lastFocus || !IsAContainerForB(qobject_cast<QWidget*>(obj), s_lastFocus))

+ 0 - 1
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/Button.cpp

@@ -6,7 +6,6 @@
  *
  */
 
-
 #include <AzToolsFramework/ViewportUi/Button.h>
 
 namespace AzToolsFramework::ViewportUi::Internal

+ 2 - 2
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/Button.h

@@ -28,7 +28,7 @@ namespace AzToolsFramework::ViewportUi::Internal
 
         AZStd::string m_icon; //!< The icon for this button, string path to an image.
         AZStd::string m_name; //!< The name displayed as a label next to the button's icon.
-        State m_state = State::Deselected; 
-        ButtonId m_buttonId; 
+        State m_state = State::Deselected;
+        ButtonId m_buttonId;
     };
 } // namespace AzToolsFramework::ViewportUi::Internal

+ 4 - 3
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ButtonGroup.cpp

@@ -45,11 +45,11 @@ namespace AzToolsFramework::ViewportUi::Internal
 
         if (name.empty())
         {
-            m_buttons.insert({buttonId, AZStd::make_unique<Button>(icon, buttonId)});
+            m_buttons.insert({ buttonId, AZStd::make_unique<Button>(icon, buttonId) });
         }
         else
         {
-            m_buttons.insert({buttonId, AZStd::make_unique<Button>(icon, name, buttonId)});
+            m_buttons.insert({ buttonId, AZStd::make_unique<Button>(icon, name, buttonId) });
         }
         return buttonId;
     }
@@ -73,7 +73,8 @@ namespace AzToolsFramework::ViewportUi::Internal
         return buttons;
     }
 
-    void ButtonGroup::ConnectEventHandler(AZ::Event<ButtonId>::Handler& handler) {
+    void ButtonGroup::ConnectEventHandler(AZ::Event<ButtonId>::Handler& handler)
+    {
         handler.Connect(m_buttonTriggeredEvent);
     }
 

+ 2 - 2
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ButtonGroup.h

@@ -1,5 +1,3 @@
-#pragma once
-
 /*
  * Copyright (c) Contributors to the Open 3D Engine Project.
  * For complete copyright and license terms please see the LICENSE at the root of this distribution.
@@ -8,6 +6,8 @@
  *
  */
 
+#pragma once
+
 #include <AzToolsFramework/ViewportUi/ViewportUiRequestBus.h>
 
 namespace AzToolsFramework::ViewportUi::Internal

+ 1 - 3
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/TextField.cpp

@@ -10,9 +10,7 @@
 
 namespace AzToolsFramework::ViewportUi::Internal
 {
-    TextField::TextField(
-        const AZStd::string& labelText, const AZStd::string& fieldText,
-        TextFieldValidationType validationType)
+    TextField::TextField(const AZStd::string& labelText, const AZStd::string& fieldText, TextFieldValidationType validationType)
         : m_labelText(labelText)
         , m_fieldText(fieldText)
         , m_validationType(validationType)

+ 4 - 3
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/TextField.h

@@ -19,16 +19,17 @@ namespace AzToolsFramework::ViewportUi::Internal
     {
     public:
         TextField(
-            const AZStd::string& labelText = "", const AZStd::string& fieldText = "",
+            const AZStd::string& labelText = "",
+            const AZStd::string& fieldText = "",
             TextFieldValidationType validationType = TextFieldValidationType::String);
         ~TextField() = default;
 
         void ConnectEventHandler(AZ::Event<AZStd::string>::Handler& handler);
 
         //! Default text for the text field. Will be cast to same type as m_validationType.
-        AZStd::string m_fieldText; 
+        AZStd::string m_fieldText;
         AZStd::string m_labelText;
-        TextFieldValidationType m_validationType; //<! The type of validator for this text edit.
+        TextFieldValidationType m_validationType; //!< The type of validator for this text edit.
         TextFieldId m_textFieldId;
         ViewportUiElementId m_viewportId;
         AZ::Event<AZStd::string> m_textEditedEvent;

+ 25 - 18
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiCluster.cpp

@@ -6,7 +6,6 @@
  *
  */
 
-
 #include <AzToolsFramework/ViewportUi/ButtonGroup.h>
 #include <AzToolsFramework/ViewportUi/ViewportUiCluster.h>
 
@@ -14,13 +13,12 @@ namespace AzToolsFramework::ViewportUi::Internal
 {
     ViewportUiCluster::ViewportUiCluster(AZStd::shared_ptr<ButtonGroup> buttonGroup)
         : QToolBar(nullptr)
-        , m_buttonGroup(buttonGroup)
+        , m_buttonGroup(AZStd::move(buttonGroup))
     {
         setOrientation(Qt::Orientation::Vertical);
         setStyleSheet("background: black;");
 
-        const AZStd::vector<Button*> buttons = buttonGroup->GetButtons();
-        for (auto button : buttons)
+        for (auto button : m_buttonGroup->GetButtons())
         {
             RegisterButton(button);
         }
@@ -34,10 +32,12 @@ namespace AzToolsFramework::ViewportUi::Internal
 
         AddClusterAction(
             action,
-            [this, button]() {
+            [this, button]()
+            {
                 m_buttonGroup->PressButton(button->m_buttonId);
             },
-            [button](QAction* action) {
+            [button](QAction* action)
+            {
                 action->setChecked(button->m_state == Button::State::Selected);
             });
 
@@ -46,8 +46,7 @@ namespace AzToolsFramework::ViewportUi::Internal
 
     void ViewportUiCluster::RemoveButton(ButtonId buttonId)
     {
-        if (auto actionEntry = m_buttonActionMap.find(buttonId);
-            actionEntry != m_buttonActionMap.end())
+        if (auto actionEntry = m_buttonActionMap.find(buttonId); actionEntry != m_buttonActionMap.end())
         {
             auto action = actionEntry->second;
             RemoveClusterAction(action);
@@ -56,8 +55,7 @@ namespace AzToolsFramework::ViewportUi::Internal
     }
 
     void ViewportUiCluster::AddClusterAction(
-        QAction* action, const AZStd::function<void()>& callback,
-        const AZStd::function<void(QAction*)>& updateCallback)
+        QAction* action, const AZStd::function<void()>& callback, const AZStd::function<void(QAction*)>& updateCallback)
     {
         if (!action)
         {
@@ -80,10 +78,12 @@ namespace AzToolsFramework::ViewportUi::Internal
         }
 
         // register the action
-        m_widgetCallbacks.AddWidget(action, [updateCallback](QPointer<QObject> object)
-        {
-            updateCallback(static_cast<QAction*>(object.data()));
-        });
+        m_widgetCallbacks.AddWidget(
+            action,
+            [updateCallback](QPointer<QObject> object)
+            {
+                updateCallback(static_cast<QAction*>(object.data()));
+            });
     }
 
     void ViewportUiCluster::RemoveClusterAction(QAction* action)
@@ -111,10 +111,13 @@ namespace AzToolsFramework::ViewportUi::Internal
         if (m_lockedButtonId.has_value() && isLocked)
         {
             // find the button to extract the old icon (without overlay)
-            auto findLocked = [this](const Button* button) { return (button->m_buttonId == m_lockedButtonId); };
+            auto findLocked = [this](const Button* button)
+            {
+                return (button->m_buttonId == m_lockedButtonId);
+            };
             if (auto lockedButtonIt = AZStd::find_if(buttons.begin(), buttons.end(), findLocked); lockedButtonIt != buttons.end())
             {
-                // get the action corresponding to the lockedButtonId 
+                // get the action corresponding to the lockedButtonId
                 if (auto actionEntry = m_buttonActionMap.find(m_lockedButtonId.value()); actionEntry != m_buttonActionMap.end())
                 {
                     // remove the overlay
@@ -124,14 +127,18 @@ namespace AzToolsFramework::ViewportUi::Internal
             }
         }
 
-        auto found = [buttonId](Button* button) { return (button->m_buttonId == buttonId); };
+        auto found = [buttonId](Button* button)
+        {
+            return (button->m_buttonId == buttonId);
+        };
+
         if (auto buttonIt = AZStd::find_if(buttons.begin(), buttons.end(), found); buttonIt != buttons.end())
         {
             QIcon newIcon;
 
             if (isLocked)
             {
-                // overlay the locked icon ontop of the button's icon
+                // overlay the locked icon on top of the button's icon
                 QPixmap comboPixmap(24, 24);
                 comboPixmap.fill(Qt::transparent);
                 QPixmap firstImage(QString((*buttonIt)->m_icon.c_str()));

+ 4 - 5
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiCluster.h

@@ -12,16 +12,16 @@
 #include <AzCore/std/smart_ptr/shared_ptr.h>
 #include <AzToolsFramework/ViewportUi/Button.h>
 #include <AzToolsFramework/ViewportUi/ViewportUiWidgetCallbacks.h>
-#include <QToolBar>
+
 #include <QPainter>
+#include <QToolBar>
 
 namespace AzToolsFramework::ViewportUi::Internal
 {
     class ButtonGroup;
 
     //! Helper class to make clusters (toolbars) for display in Viewport UI.
-    class ViewportUiCluster
-        : public QToolBar
+    class ViewportUiCluster : public QToolBar
     {
         Q_OBJECT
 
@@ -45,8 +45,7 @@ namespace AzToolsFramework::ViewportUi::Internal
     private:
         //! Adds an action to the Viewport UI Cluster.
         void AddClusterAction(
-            QAction* action, const AZStd::function<void()>& callback = {},
-            const AZStd::function<void(QAction*)>& updateCallback = {});
+            QAction* action, const AZStd::function<void()>& callback = {}, const AZStd::function<void(QAction*)>& updateCallback = {});
         //! Removes an action from the Viewport UI Cluster.
         void RemoveClusterAction(QAction* action);
 

+ 42 - 73
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiDisplay.cpp

@@ -6,13 +6,12 @@
  *
  */
 
-
 #include <AzCore/std/smart_ptr/make_shared.h>
 #include <AzFramework/Viewport/ViewportScreen.h>
 #include <AzToolsFramework/Viewport/ViewportMessages.h>
 #include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
-#include <AzToolsFramework/ViewportUi/ViewportUiDisplay.h>
 #include <AzToolsFramework/ViewportUi/ViewportUiCluster.h>
+#include <AzToolsFramework/ViewportUi/ViewportUiDisplay.h>
 #include <AzToolsFramework/ViewportUi/ViewportUiSwitcher.h>
 #include <AzToolsFramework/ViewportUi/ViewportUiTextField.h>
 #include <QWidget>
@@ -34,9 +33,9 @@ namespace AzToolsFramework::ViewportUi::Internal
         }
     }
 
-    static Qt::Alignment GetQtAlignment(Alignment align)
+    static Qt::Alignment GetQtAlignment(const Alignment alignment)
     {
-        switch (align)
+        switch (alignment)
         {
         case Alignment::TopRight:
             return Qt::AlignTop | Qt::AlignRight;
@@ -52,7 +51,7 @@ namespace AzToolsFramework::ViewportUi::Internal
             return Qt::AlignBottom;
         }
 
-        AZ_Assert(false, "ViewportUI", "Unhandled ViewportUI Alignment %d", static_cast<int>(align));
+        AZ_Assert(false, "ViewportUI", "Unhandled ViewportUI Alignment %d", static_cast<int>(alignment));
         return Qt::AlignTop;
     }
 
@@ -71,7 +70,7 @@ namespace AzToolsFramework::ViewportUi::Internal
         UnparentWidgets(m_viewportUiElements);
     }
 
-    void ViewportUiDisplay::AddCluster(AZStd::shared_ptr<ButtonGroup> buttonGroup, const Alignment align)
+    void ViewportUiDisplay::AddCluster(AZStd::shared_ptr<ButtonGroup> buttonGroup, const Alignment alignment)
     {
         if (!buttonGroup.get())
         {
@@ -81,11 +80,10 @@ namespace AzToolsFramework::ViewportUi::Internal
         auto viewportUiCluster = AZStd::make_shared<ViewportUiCluster>(buttonGroup);
         auto id = AddViewportUiElement(viewportUiCluster);
         buttonGroup->SetViewportUiElementId(id);
-        PositionViewportUiElementAnchored(id, GetQtAlignment(align));
+        PositionViewportUiElementAnchored(id, GetQtAlignment(alignment));
     }
 
-    void ViewportUiDisplay::AddClusterButton(
-        const ViewportUiElementId clusterId, Button* button)
+    void ViewportUiDisplay::AddClusterButton(const ViewportUiElementId clusterId, Button* button)
     {
         if (auto viewportUiCluster = qobject_cast<ViewportUiCluster*>(GetViewportUiElement(clusterId).get()))
         {
@@ -101,7 +99,8 @@ namespace AzToolsFramework::ViewportUi::Internal
         }
     }
 
-    void ViewportUiDisplay::SetClusterButtonTooltip(const ViewportUiElementId clusterId, const ButtonId buttonId, const AZStd::string& tooltip)
+    void ViewportUiDisplay::SetClusterButtonTooltip(
+        const ViewportUiElementId clusterId, const ButtonId buttonId, const AZStd::string& tooltip)
     {
         if (auto viewportUiCluster = qobject_cast<ViewportUiCluster*>(GetViewportUiElement(clusterId).get()))
         {
@@ -125,7 +124,7 @@ namespace AzToolsFramework::ViewportUi::Internal
         }
     }
 
-    void ViewportUiDisplay::AddSwitcher(AZStd::shared_ptr<ButtonGroup> buttonGroup, const Alignment align)
+    void ViewportUiDisplay::AddSwitcher(AZStd::shared_ptr<ButtonGroup> buttonGroup, const Alignment alignment)
     {
         if (!buttonGroup.get())
         {
@@ -135,7 +134,7 @@ namespace AzToolsFramework::ViewportUi::Internal
         auto viewportUiSwitcher = AZStd::make_shared<ViewportUiSwitcher>(buttonGroup);
         auto id = AddViewportUiElement(viewportUiSwitcher);
         buttonGroup->SetViewportUiElementId(id);
-        PositionViewportUiElementAnchored(id, GetQtAlignment(align));
+        PositionViewportUiElementAnchored(id, GetQtAlignment(alignment));
     }
 
     void ViewportUiDisplay::AddSwitcherButton(const ViewportUiElementId clusterId, Button* button)
@@ -198,11 +197,12 @@ namespace AzToolsFramework::ViewportUi::Internal
             const ViewportUiElementInfo& elementInfo = element.second;
             if (!elementInfo.m_anchored)
             {
-                const auto screenPoint = AzFramework::WorldToScreen(
-                    elementInfo.m_worldPosition, AzToolsFramework::GetCameraState(m_viewportId));
+                const auto screenPoint =
+                    AzFramework::WorldToScreen(elementInfo.m_worldPosition, AzToolsFramework::GetCameraState(m_viewportId));
                 elementInfo.m_widget->move(screenPoint.m_x, screenPoint.m_y);
             }
         }
+
         PositionUiOverlayOverRenderViewport();
     }
 
@@ -216,7 +216,6 @@ namespace AzToolsFramework::ViewportUi::Internal
         ViewportUiElementId newId = ViewportUiElementId(++m_numViewportElements);
         ViewportUiElementInfo newElement{ widget, newId, true };
         m_viewportUiElements.insert({ newId, newElement });
-        SetUiOverlayContents(widget.get());
         return newId;
     }
 
@@ -233,8 +232,11 @@ namespace AzToolsFramework::ViewportUi::Internal
     ViewportUiElementId ViewportUiDisplay::GetViewportUiElementId(QPointer<QWidget> widget)
     {
         if (auto element = AZStd::find_if(
-            m_viewportUiElements.begin(), m_viewportUiElements.end(),
-            [widget](const auto& it) { return it.second.m_widget.get() == widget; });
+                m_viewportUiElements.begin(), m_viewportUiElements.end(),
+                [widget](const auto& it)
+                {
+                    return it.second.m_widget.get() == widget;
+                });
             element != m_viewportUiElements.end())
         {
             return element->second.m_viewportUiElementId;
@@ -245,7 +247,8 @@ namespace AzToolsFramework::ViewportUi::Internal
 
     void ViewportUiDisplay::RemoveViewportUiElement(ViewportUiElementId elementId)
     {
-        AZ_Assert(elementId != AzToolsFramework::ViewportUi::InvalidViewportUiElementId,
+        AZ_Assert(
+            elementId != AzToolsFramework::ViewportUi::InvalidViewportUiElementId,
             "Tried to remove a Viewport UI element using an invalid or removed ViewportUiElementId.");
 
         auto viewportUiMapElement = m_viewportUiElements.find(elementId);
@@ -264,8 +267,7 @@ namespace AzToolsFramework::ViewportUi::Internal
 
     void ViewportUiDisplay::ShowViewportUiElement(ViewportUiElementId elementId)
     {
-        if (ViewportUiElementInfo element = GetViewportUiElementInfo(elementId);
-            element.m_widget)
+        if (ViewportUiElementInfo element = GetViewportUiElementInfo(elementId); element.m_widget)
         {
             element.m_widget->setVisible(true);
         }
@@ -273,8 +275,7 @@ namespace AzToolsFramework::ViewportUi::Internal
 
     void ViewportUiDisplay::HideViewportUiElement(ViewportUiElementId elementId)
     {
-        if (ViewportUiElementInfo element = GetViewportUiElementInfo(elementId);
-            element.m_widget)
+        if (ViewportUiElementInfo element = GetViewportUiElementInfo(elementId); element.m_widget)
         {
             element.m_widget->setVisible(false);
         }
@@ -282,8 +283,7 @@ namespace AzToolsFramework::ViewportUi::Internal
 
     bool ViewportUiDisplay::IsViewportUiElementVisible(ViewportUiElementId elementId)
     {
-        if (ViewportUiElementInfo element = GetViewportUiElementInfo(elementId);
-            element.m_widget)
+        if (ViewportUiElementInfo element = GetViewportUiElementInfo(elementId); element.m_widget)
         {
             return element.IsValid() && element.m_widget->isVisible();
         }
@@ -293,12 +293,12 @@ namespace AzToolsFramework::ViewportUi::Internal
     void ViewportUiDisplay::CreateComponentModeBorder(const AZStd::string& borderTitle)
     {
         AZStd::string styleSheet = AZStd::string::format(
-            "border: %dpx solid %s; border-top: %dpx solid %s;", HighlightBorderSize,
-            HighlightBorderColor, TopHighlightBorderSize, HighlightBorderColor);
+            "border: %dpx solid %s; border-top: %dpx solid %s;", HighlightBorderSize, HighlightBorderColor, TopHighlightBorderSize,
+            HighlightBorderColor);
         m_uiOverlay.setStyleSheet(styleSheet.c_str());
-        m_uiOverlayLayout.setContentsMargins(HighlightBorderSize + ViewportUiOverlayMargin,
-            TopHighlightBorderSize + ViewportUiOverlayMargin, HighlightBorderSize + ViewportUiOverlayMargin,
-            HighlightBorderSize + ViewportUiOverlayMargin);
+        m_uiOverlayLayout.setContentsMargins(
+            HighlightBorderSize + ViewportUiOverlayMargin, TopHighlightBorderSize + ViewportUiOverlayMargin,
+            HighlightBorderSize + ViewportUiOverlayMargin, HighlightBorderSize + ViewportUiOverlayMargin);
         m_componentModeBorderText.setVisible(true);
         m_componentModeBorderText.setText(borderTitle.c_str());
     }
@@ -314,8 +314,7 @@ namespace AzToolsFramework::ViewportUi::Internal
     {
         auto viewportUiMapElement = m_viewportUiElements.find(elementId);
 
-        if (viewportUiMapElement != m_viewportUiElements.end() &&
-            viewportUiMapElement->second.m_widget)
+        if (viewportUiMapElement != m_viewportUiElements.end() && viewportUiMapElement->second.m_widget)
         {
             viewportUiMapElement->second.m_anchored = false;
             viewportUiMapElement->second.m_worldPosition = pos;
@@ -328,48 +327,25 @@ namespace AzToolsFramework::ViewportUi::Internal
     {
         auto viewportUiMapElement = m_viewportUiElements.find(elementId);
 
-        if (viewportUiMapElement != m_viewportUiElements.end() &&
-            viewportUiMapElement->second.m_widget)
+        if (viewportUiMapElement != m_viewportUiElements.end() && viewportUiMapElement->second.m_widget)
         {
             viewportUiMapElement->second.m_anchored = true;
             SetUiOverlayContentsAnchored(viewportUiMapElement->second.m_widget.get(), alignment);
         }
     }
 
-    void ViewportUiDisplay::AddMaximumSizeViewportUiElement(QPointer<QWidget> widget)
-    {
-        if (widget)
-        {
-            return;
-        }
-
-        if (m_fullScreenWidget)
-        {
-            AZ_Warning(
-                "ViewportUi", false,
-                "Attaching a maximum size element when one already exists. Removing the previously attached element.");
-            RemoveViewportUiElement(GetViewportUiElementId(m_fullScreenWidget));
-        }
-
-        widget->setAttribute(Qt::WA_ShowWithoutActivating);
-        widget->setParent(&m_uiOverlay);
-        m_fullScreenWidget = widget;
-        m_fullScreenLayout.addWidget(m_fullScreenWidget, 0, 0, 1, 1);
-        m_renderOverlay->setFocus();
-    }
-
     // disables system background for widget and gives a transparent background
-    static void ConfigureWidgetForViewportUi(QPointer<QWidget> widget)
+    static void ConfigureWindowForViewportUi(QPointer<QMainWindow> mainWindow)
     {
-        // no background for the widget else each set of buttons/textfields/etc would have a black box around them
-        SetTransparentBackground(widget);
-        widget->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus);
+        // no background for the widget else each set of buttons/text-fields/etc would have a black box around them
+        SetTransparentBackground(mainWindow);
+        mainWindow->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus);
     }
 
     void ViewportUiDisplay::InitializeUiOverlay()
     {
         m_uiMainWindow.setObjectName(QString("ViewportUiWindow"));
-        ConfigureWidgetForViewportUi(&m_uiMainWindow);
+        ConfigureWindowForViewportUi(&m_uiMainWindow);
         m_uiMainWindow.setVisible(false);
 
         m_uiOverlay.setObjectName(QString("ViewportUiOverlay"));
@@ -382,8 +358,7 @@ namespace AzToolsFramework::ViewportUi::Internal
         m_fullScreenLayout.addLayout(&m_uiOverlayLayout, 0, 0, 1, 1);
 
         // format the label which will appear on top of the highlight border
-        AZStd::string styleSheet = AZStd::string::format(
-            "background-color: %s; border: none;", HighlightBorderColor);
+        AZStd::string styleSheet = AZStd::string::format("background-color: %s; border: none;", HighlightBorderColor);
         m_componentModeBorderText.setStyleSheet(styleSheet.c_str());
         m_componentModeBorderText.setFixedHeight(TopHighlightBorderSize);
         m_componentModeBorderText.setVisible(false);
@@ -408,7 +383,7 @@ namespace AzToolsFramework::ViewportUi::Internal
         m_renderOverlay->setFocus();
     }
 
-    void ViewportUiDisplay::SetUiOverlayContentsAnchored(QPointer<QWidget> widget, Qt::Alignment alignment)
+    void ViewportUiDisplay::SetUiOverlayContentsAnchored(QPointer<QWidget> widget, const Qt::Alignment alignment)
     {
         if (!widget)
         {
@@ -429,13 +404,8 @@ namespace AzToolsFramework::ViewportUi::Internal
             // get the border region by taking the entire region and subtracting the non-border area
             region += m_uiOverlay.rect();
             region -= QRect(
-                QPoint(
-                    m_uiOverlay.rect().left() + HighlightBorderSize,
-                    m_uiOverlay.rect().top() + TopHighlightBorderSize),
-                QPoint(
-                    m_uiOverlay.rect().right() - HighlightBorderSize,
-                    m_uiOverlay.rect().bottom() - HighlightBorderSize)
-            );
+                QPoint(m_uiOverlay.rect().left() + HighlightBorderSize, m_uiOverlay.rect().top() + TopHighlightBorderSize),
+                QPoint(m_uiOverlay.rect().right() - HighlightBorderSize, m_uiOverlay.rect().bottom() - HighlightBorderSize));
         }
 
         // add all children widget regions
@@ -465,8 +435,7 @@ namespace AzToolsFramework::ViewportUi::Internal
 
     ViewportUiElementInfo ViewportUiDisplay::GetViewportUiElementInfo(const ViewportUiElementId elementId)
     {
-        if (auto element = m_viewportUiElements.find(elementId);
-            element != m_viewportUiElements.end())
+        if (auto element = m_viewportUiElements.find(elementId); element != m_viewportUiElements.end())
         {
             return element->second;
         }
@@ -488,7 +457,7 @@ namespace AzToolsFramework::ViewportUi::Internal
         return &m_uiOverlayLayout;
     }
 
-    void SetTransparentBackground(QWidget * widget)
+    void SetTransparentBackground(QWidget* widget)
     {
         widget->setAttribute(Qt::WA_TranslucentBackground);
         widget->setAutoFillBackground(false);

+ 18 - 18
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiDisplay.h

@@ -11,11 +11,12 @@
 #include <AzToolsFramework/ViewportUi/Button.h>
 #include <AzToolsFramework/ViewportUi/ButtonGroup.h>
 #include <AzToolsFramework/ViewportUi/TextField.h>
-#include <AzToolsFramework/ViewportUi/ViewportUiRequestBus.h>
 #include <AzToolsFramework/ViewportUi/ViewportUiDisplayLayout.h>
+#include <AzToolsFramework/ViewportUi/ViewportUiRequestBus.h>
+
+#include <QLabel>
 #include <QMainWindow>
 #include <QPointer>
-#include <QLabel>
 
 AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option")
 #include <QGridLayout>
@@ -28,10 +29,10 @@ namespace AzToolsFramework::ViewportUi::Internal
     //! Used to track info for each widget in the Viewport UI.
     struct ViewportUiElementInfo
     {
-        AZStd::shared_ptr<QWidget> m_widget; //<! Reference to the widget.
-        ViewportUiElementId m_viewportUiElementId; //<! Corresponding ViewportUiElementId of the widget.
-        bool m_anchored = true; //<! Whether the widget is anchored to one position or moves with camera/entity.
-        AZ::Vector3 m_worldPosition; //<! If not anchored, use this to project widget position to screen space.
+        AZStd::shared_ptr<QWidget> m_widget; //!< Reference to the widget.
+        ViewportUiElementId m_viewportUiElementId; //!< Corresponding ViewportUiElementId of the widget.
+        bool m_anchored = true; //!< Whether the widget is anchored to one position or moves with camera/entity.
+        AZ::Vector3 m_worldPosition; //!< If not anchored, use this to project widget position to screen space.
 
         bool IsValid() const
         {
@@ -52,14 +53,14 @@ namespace AzToolsFramework::ViewportUi::Internal
         ViewportUiDisplay(QWidget* parent, QWidget* renderOverlay);
         ~ViewportUiDisplay();
 
-        void AddCluster(AZStd::shared_ptr<ButtonGroup> buttonGroup, Alignment align);
+        void AddCluster(AZStd::shared_ptr<ButtonGroup> buttonGroup, Alignment alignment);
         void AddClusterButton(ViewportUiElementId clusterId, Button* button);
         void SetClusterButtonLocked(ViewportUiElementId clusterId, ButtonId buttonId, bool isLocked);
         void SetClusterButtonTooltip(ViewportUiElementId clusterId, ButtonId buttonId, const AZStd::string& tooltip);
         void RemoveClusterButton(ViewportUiElementId clusterId, ButtonId buttonId);
         void UpdateCluster(const ViewportUiElementId clusterId);
 
-        void AddSwitcher(AZStd::shared_ptr<ButtonGroup> buttonGroup, Alignment align);
+        void AddSwitcher(AZStd::shared_ptr<ButtonGroup> buttonGroup, Alignment alignment);
         void AddSwitcherButton(ViewportUiElementId switcherId, Button* button);
         void RemoveSwitcherButton(ViewportUiElementId switcherId, ButtonId buttonId);
         void UpdateSwitcher(ViewportUiElementId switcherId);
@@ -90,13 +91,12 @@ namespace AzToolsFramework::ViewportUi::Internal
 
         void CreateComponentModeBorder(const AZStd::string& borderTitle);
         void RemoveComponentModeBorder();
-        
+
     private:
         void PrepareWidgetForViewportUi(QPointer<QWidget> widget);
 
         ViewportUiElementId AddViewportUiElement(AZStd::shared_ptr<QWidget> widget);
         ViewportUiElementId GetViewportUiElementId(QPointer<QWidget> widget);
-        void AddMaximumSizeViewportUiElement(QPointer<QWidget> widget);
 
         void PositionViewportUiElementFromWorldSpace(ViewportUiElementId elementId, const AZ::Vector3& pos);
         void PositionViewportUiElementAnchored(ViewportUiElementId elementId, const Qt::Alignment alignment);
@@ -109,16 +109,16 @@ namespace AzToolsFramework::ViewportUi::Internal
 
         ViewportUiElementInfo GetViewportUiElementInfo(const ViewportUiElementId elementId);
 
-        QMainWindow m_uiMainWindow; //<! The window which contains the UI Overlay.
-        QWidget m_uiOverlay; //<! The UI Overlay which displays Viewport UI Elements.
-        QGridLayout m_fullScreenLayout; //<! The layout which extends across the full screen.
-        ViewportUiDisplayLayout m_uiOverlayLayout; //<! The layout used for optionally anchoring Viewport UI Elements.
-        QLabel m_componentModeBorderText; //<! The text used for the Component Mode border.
+        QMainWindow m_uiMainWindow; //!< The window which contains the UI Overlay.
+        QWidget m_uiOverlay; //!< The UI Overlay which displays Viewport UI Elements.
+        QGridLayout m_fullScreenLayout; //!< The layout which extends across the full screen.
+        ViewportUiDisplayLayout m_uiOverlayLayout; //!< The layout used for optionally anchoring Viewport UI Elements.
+        QLabel m_componentModeBorderText; //!< The text used for the Component Mode border.
 
         QWidget* m_renderOverlay;
-        QPointer<QWidget> m_fullScreenWidget; //<! Reference to the widget attached to m_fullScreenLayout if any.
-        int m_viewportId;
-        int64_t m_numViewportElements = 0; 
+        QPointer<QWidget> m_fullScreenWidget; //!< Reference to the widget attached to m_fullScreenLayout if any.
+        int64_t m_numViewportElements = 0;
+        int m_viewportId = 0;
 
         ViewportUiElementIdInfoLookup m_viewportUiElements;
     };

+ 10 - 7
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiDisplayLayout.cpp

@@ -6,15 +6,19 @@
  *
  */
 
-
 #include <AzCore/Console/IConsole.h>
 #include <AzToolsFramework/ViewportUi/ViewportUiDisplayLayout.h>
-#include <QtWidgets/QWidget>
+
+#include <QWidget>
 
 namespace AzToolsFramework::ViewportUi::Internal
 {
     AZ_CVAR(
-        int, ViewportUiDisplayLayoutSpacing, 5, nullptr, AZ::ConsoleFunctorFlags::Null,
+        int,
+        ViewportUiDisplayLayoutSpacing,
+        5,
+        nullptr,
+        AZ::ConsoleFunctorFlags::Null,
         "The spacing between elements attached to the Viewport UI Display Layout");
 
     ViewportUiDisplayLayout::ViewportUiDisplayLayout(QWidget* parent)
@@ -27,7 +31,7 @@ namespace AzToolsFramework::ViewportUi::Internal
         setSpacing(ViewportUiDisplayLayoutSpacing);
 
         // create a 3x2 map of sub layouts which will stack widgets according to their mapped alignment
-        m_internalLayouts = AZStd::unordered_map<Qt::Alignment, QBoxLayout*> {
+        m_internalLayouts = AZStd::unordered_map<Qt::Alignment, QBoxLayout*>{
             CreateSubLayout(new QVBoxLayout(), 0, 0, Qt::AlignTop | Qt::AlignLeft),
             CreateSubLayout(new QVBoxLayout(), 1, 0, Qt::AlignBottom | Qt::AlignLeft),
             CreateSubLayout(new QVBoxLayout(), 0, 1, Qt::AlignTop),
@@ -45,8 +49,7 @@ namespace AzToolsFramework::ViewportUi::Internal
         }
 
         // find the corresponding sub layout for the alignment and add the widget
-        if (auto layoutForAlignment = m_internalLayouts.find(alignment);
-            layoutForAlignment != m_internalLayouts.end())
+        if (auto layoutForAlignment = m_internalLayouts.find(alignment); layoutForAlignment != m_internalLayouts.end())
         {
             // place the widget before or after the invisible spacer
             // depending on the layout alignment
@@ -97,7 +100,7 @@ namespace AzToolsFramework::ViewportUi::Internal
         // without this, alignment and resizing within the sublayouts becomes difficult
         layout->addStretch(1);
 
-        addLayout(layout, row, column, /*rowSpan=*/ 1, /*colSpan=*/ 1, alignment);
+        addLayout(layout, row, column, /*rowSpan=*/1, /*colSpan=*/1, alignment);
 
         return { alignment, layout };
     }

+ 3 - 3
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiDisplayLayout.h

@@ -9,8 +9,9 @@
 #pragma once
 
 #include <AzCore/std/containers/unordered_map.h>
-#include <QGridLayout>
+
 #include <QBoxLayout>
+#include <QGridLayout>
 #include <QPointer>
 
 namespace AzToolsFramework::ViewportUi::Internal
@@ -33,8 +34,7 @@ namespace AzToolsFramework::ViewportUi::Internal
     private:
         //! Create a sub-layout to add to the grid of layouts.
         //! @return A pair of the new layout along with its alignment on the grid.
-        AZStd::pair<Qt::Alignment, QBoxLayout*> CreateSubLayout(
-            QBoxLayout* layout, int row, int column, Qt::Alignment alignment);
+        AZStd::pair<Qt::Alignment, QBoxLayout*> CreateSubLayout(QBoxLayout* layout, int row, int column, Qt::Alignment alignment);
 
         //! A mapping of each sub-layout to its corresponding alignment on the grid.
         AZStd::unordered_map<Qt::Alignment, QBoxLayout*> m_internalLayouts;

+ 9 - 15
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiManager.cpp

@@ -6,12 +6,11 @@
  *
  */
 
-
 #include <AzCore/std/smart_ptr/make_shared.h>
 #include <AzToolsFramework/ViewportUi/Button.h>
 #include <AzToolsFramework/ViewportUi/ButtonGroup.h>
-#include <AzToolsFramework/ViewportUi/ViewportUiManager.h>
 #include <AzToolsFramework/ViewportUi/ViewportUiDisplay.h>
+#include <AzToolsFramework/ViewportUi/ViewportUiManager.h>
 
 namespace AzToolsFramework::ViewportUi
 {
@@ -114,7 +113,8 @@ namespace AzToolsFramework::ViewportUi
         return ButtonId(0);
     }
 
-    const ButtonId ViewportUiManager::CreateSwitcherButton(const SwitcherId switcherId, const AZStd::string& icon, const AZStd::string& name)
+    const ButtonId ViewportUiManager::CreateSwitcherButton(
+        const SwitcherId switcherId, const AZStd::string& icon, const AZStd::string& name)
     {
         if (auto switcherIt = m_switcherButtonGroups.find(switcherId); switcherIt != m_switcherButtonGroups.end())
         {
@@ -146,8 +146,7 @@ namespace AzToolsFramework::ViewportUi
         }
     }
 
-    static void SetViewportUiElementVisible(
-        Internal::ViewportUiDisplay* ui, ViewportUiElementId id, bool visible)
+    static void SetViewportUiElementVisible(Internal::ViewportUiDisplay* ui, ViewportUiElementId id, bool visible)
     {
         if (visible)
         {
@@ -186,11 +185,9 @@ namespace AzToolsFramework::ViewportUi
     }
 
     const TextFieldId ViewportUiManager::CreateTextField(
-        const AZStd::string& labelText, const AZStd::string& textFieldDefaultText,
-        TextFieldValidationType validationType) 
+        const AZStd::string& labelText, const AZStd::string& textFieldDefaultText, TextFieldValidationType validationType)
     {
-        auto textField = AZStd::make_shared<Internal::TextField>(
-            labelText, textFieldDefaultText, validationType);
+        auto textField = AZStd::make_shared<Internal::TextField>(labelText, textFieldDefaultText, validationType);
         m_viewportUi->AddTextField(textField);
 
         return RegisterNewTextField(textField);
@@ -206,8 +203,7 @@ namespace AzToolsFramework::ViewportUi
         }
     }
 
-    void ViewportUiManager::RegisterTextFieldCallback(
-        TextFieldId textFieldId, AZ::Event<AZStd::string>::Handler& handler) 
+    void ViewportUiManager::RegisterTextFieldCallback(TextFieldId textFieldId, AZ::Event<AZStd::string>::Handler& handler)
     {
         if (auto textFieldIt = m_textFields.find(textFieldId); textFieldIt != m_textFields.end())
         {
@@ -234,7 +230,6 @@ namespace AzToolsFramework::ViewportUi
         }
     }
 
-
     void ViewportUiManager::CreateComponentModeBorder(const AZStd::string& borderTitle)
     {
         m_viewportUi->CreateComponentModeBorder(borderTitle);
@@ -248,8 +243,7 @@ namespace AzToolsFramework::ViewportUi
     void ViewportUiManager::PressButton(ClusterId clusterId, ButtonId buttonId)
     {
         // Find cluster using ID and cluster map
-        if (auto clusterIt = m_clusterButtonGroups.find(clusterId);
-            clusterIt != m_clusterButtonGroups.end())
+        if (auto clusterIt = m_clusterButtonGroups.find(clusterId); clusterIt != m_clusterButtonGroups.end())
         {
             clusterIt->second->PressButton(buttonId);
         }
@@ -305,7 +299,7 @@ namespace AzToolsFramework::ViewportUi
     SwitcherId ViewportUiManager::RegisterNewSwitcher(AZStd::shared_ptr<Internal::ButtonGroup>& buttonGroup)
     {
         SwitcherId newId = SwitcherId(m_switcherButtonGroups.size() + 1);
-        m_switcherButtonGroups.insert({newId, buttonGroup});
+        m_switcherButtonGroups.insert({ newId, buttonGroup });
 
         return newId;
     }

+ 1 - 1
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiManager.h

@@ -18,7 +18,7 @@ namespace AzToolsFramework::ViewportUi
     {
         class ButtonGroup;
         class ViewportUiDisplay;
-    }
+    } // namespace Internal
 
     class ViewportUiManager : public ViewportUiRequestBus::Handler
     {

+ 17 - 6
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiSwitcher.cpp

@@ -65,8 +65,12 @@ namespace AzToolsFramework::ViewportUi::Internal
         // resize to fit new action with minimum extra space
         resize(minimumSizeHint());
 
-        const AZStd::function<void()>& callback = [this, button]() { m_buttonGroup->PressButton(button->m_buttonId); };
-        const AZStd::function<void(QAction*)>& updateCallback = [button](QAction* action) {
+        const AZStd::function<void()>& callback = [this, button]()
+        {
+            m_buttonGroup->PressButton(button->m_buttonId);
+        };
+        const AZStd::function<void(QAction*)>& updateCallback = [button](QAction* action)
+        {
             action->setChecked(button->m_state == Button::State::Selected);
         };
 
@@ -78,9 +82,13 @@ namespace AzToolsFramework::ViewportUi::Internal
 
         // register the action
         m_widgetCallbacks.AddWidget(
-            action, [updateCallback](QPointer<QObject> object) { updateCallback(static_cast<QAction*>(object.data())); });
+            action,
+            [updateCallback](QPointer<QObject> object)
+            {
+                updateCallback(static_cast<QAction*>(object.data()));
+            });
 
-        m_buttonActionMap.insert({button->m_buttonId, action});
+        m_buttonActionMap.insert({ button->m_buttonId, action });
     }
 
     void ViewportUiSwitcher::RemoveButton(ButtonId buttonId)
@@ -121,9 +129,12 @@ namespace AzToolsFramework::ViewportUi::Internal
         // Check if it is the first active mode to be set
         bool initialActiveMode = (m_activeButtonId == ButtonId(0));
 
-        // Change the toolbutton's name and icon to that button
+        // Change the tool button's name and icon to that button
         const AZStd::vector<Button*> buttons = m_buttonGroup->GetButtons();
-        auto found = [buttonId](Button* button) { return (button->m_buttonId == buttonId); };
+        auto found = [buttonId](Button* button)
+        {
+            return (button->m_buttonId == buttonId);
+        };
 
         if (auto buttonIt = AZStd::find_if(buttons.begin(), buttons.end(), found); buttonIt != buttons.end())
         {

+ 2 - 2
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiSwitcher.h

@@ -8,11 +8,11 @@
 
 #pragma once
 
-#include <AzToolsFramework/ViewportUi/Button.h>
 #include <AzCore/std/containers/unordered_map.h>
 #include <AzCore/std/smart_ptr/shared_ptr.h>
+#include <AzToolsFramework/ViewportUi/Button.h>
 #include <AzToolsFramework/ViewportUi/ViewportUiWidgetCallbacks.h>
-#include <functional>
+
 #include <QPointer>
 #include <QToolBar>
 #include <QToolButton>

+ 13 - 7
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiTextField.cpp

@@ -6,7 +6,6 @@
  *
  */
 
-
 #include "ViewportUiTextField.h"
 
 #include <AzCore/Console/IConsole.h>
@@ -16,7 +15,11 @@
 namespace AzToolsFramework::ViewportUi::Internal
 {
     AZ_CVAR(
-        int, ViewportUiTextFieldLength, 35, nullptr, AZ::ConsoleFunctorFlags::Null,
+        int,
+        ViewportUiTextFieldLength,
+        35,
+        nullptr,
+        AZ::ConsoleFunctorFlags::Null,
         "The pixel length of the text field part of a ViewportUiTextField");
 
     ViewportUiTextField::ViewportUiTextField(AZStd::shared_ptr<TextField> textField)
@@ -56,11 +59,14 @@ namespace AzToolsFramework::ViewportUi::Internal
 
         m_lineEdit.setValidator(m_validator);
 
-        connect(&m_lineEdit, &QLineEdit::textEdited, &m_lineEdit, [textField](QString text) {
-            // convert the text using toLocal8Bit().data() as recommended by Qt, then emit signal
-            textField->m_fieldText = text.toLocal8Bit().data();
-            textField->m_textEditedEvent.Signal(textField->m_fieldText);
-        });
+        connect(
+            &m_lineEdit, &QLineEdit::textEdited, &m_lineEdit,
+            [textField](QString text)
+            {
+                // convert the text using toLocal8Bit().data() as recommended by Qt, then emit signal
+                textField->m_fieldText = text.toLocal8Bit().data();
+                textField->m_textEditedEvent.Signal(textField->m_fieldText);
+            });
     }
 
     void ViewportUiTextField::Update()

+ 8 - 8
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiTextField.h

@@ -7,7 +7,10 @@
  */
 
 #pragma once
+
+#include <AzCore/std/smart_ptr/shared_ptr.h>
 #include <AzToolsFramework/ViewportUi/TextField.h>
+
 #include <QLabel>
 #include <QLineEdit>
 #include <QWidget>
@@ -17,13 +20,10 @@ AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option")
 #include <QVBoxLayout>
 AZ_POP_DISABLE_WARNING
 
-#include <AzCore/std/smart_ptr/shared_ptr.h>
-
 namespace AzToolsFramework::ViewportUi::Internal
 {
     //! Helper class for a widget that holds and manages multiple LabelTextFields.
-    class ViewportUiTextField
-        : public QWidget
+    class ViewportUiTextField : public QWidget
     {
         Q_OBJECT
 
@@ -34,9 +34,9 @@ namespace AzToolsFramework::ViewportUi::Internal
         void Update();
 
     private:
-        QLabel m_label; //<! The text label.
-        QLineEdit m_lineEdit; //<! The editable text field.
-        QValidator* m_validator; //<! The validator for the line edit text.
-        AZStd::shared_ptr<TextField> m_textField; //<! Reference to the text field data struct.
+        QLabel m_label; //!< The text label.
+        QLineEdit m_lineEdit; //!< The editable text field.
+        QValidator* m_validator; //!< The validator for the line edit text.
+        AZStd::shared_ptr<TextField> m_textField; //!< Reference to the text field data struct.
     };
 } // namespace AzToolsFramework::ViewportUi::Internal

+ 3 - 6
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiWidgetCallbacks.cpp

@@ -6,13 +6,11 @@
  *
  */
 
-
 #include "ViewportUiWidgetCallbacks.h"
 
 namespace AzToolsFramework::ViewportUi::Internal
 {
-    void ViewportUiWidgetCallbacks::AddWidget(
-        QPointer<QObject> widget, const AZStd::function<void(QPointer<QObject>)>& updateCallback)
+    void ViewportUiWidgetCallbacks::AddWidget(QPointer<QObject> widget, const AZStd::function<void(QPointer<QObject>)>& updateCallback)
     {
         if (widget.isNull())
         {
@@ -40,7 +38,7 @@ namespace AzToolsFramework::ViewportUi::Internal
     {
         // if widget exists on the manager, register the callback
         auto callBackWidget = AZStd::find(m_widgets.begin(), m_widgets.end(), widget);
-        AZ_Assert(callBackWidget != m_widgets.end(), "Unable to register a callback for an unregistered widget.")
+        AZ_Assert(callBackWidget != m_widgets.end(), "Unable to register a callback for an unregistered widget.");
 
         if (callBackWidget != m_widgets.end())
         {
@@ -58,8 +56,7 @@ namespace AzToolsFramework::ViewportUi::Internal
                 RemoveWidget(widget);
             }
             // check if the widget has not been deleted externally
-            else if (auto callback = m_updateCallbacks.find(widget);
-                callback != m_updateCallbacks.end())
+            else if (auto callback = m_updateCallbacks.find(widget); callback != m_updateCallbacks.end())
             {
                 callback->second(widget);
             }

+ 11 - 5
Code/Framework/AzToolsFramework/AzToolsFramework/ViewportUi/ViewportUiWidgetCallbacks.h

@@ -9,12 +9,12 @@
 #pragma once
 
 #include <AzCore/Memory/Memory.h>
-#include <AzCore/std/function/function_template.h>
 #include <AzCore/std/containers/unordered_map.h>
-#include <QPointer>
-#include <QObject>
-#include <QMetaMethod>
+#include <AzCore/std/function/function_template.h>
 
+#include <QMetaMethod>
+#include <QObject>
+#include <QPointer>
 
 namespace AzToolsFramework::ViewportUi::Internal
 {
@@ -30,7 +30,8 @@ namespace AzToolsFramework::ViewportUi::Internal
         //! Must call ViewportUiWidgetCallbacks::Update to execute the callback.
         void RegisterUpdateCallback(QPointer<QObject> widget, const AZStd::function<void(QPointer<QObject>)>& callback);
         void Update();
-        const AZStd::vector<QPointer<QObject>> GetWidgets() const { return m_widgets; }
+
+        const AZStd::vector<QPointer<QObject>>& GetWidgets() const;
 
     protected:
         //! A map of all update callbacks and their respective widgets.
@@ -38,4 +39,9 @@ namespace AzToolsFramework::ViewportUi::Internal
         AZStd::unordered_map<QObject*, AZStd::function<void(QPointer<QObject>)>> m_updateCallbacks;
         AZStd::vector<QPointer<QObject>> m_widgets;
     };
+
+    inline const AZStd::vector<QPointer<QObject>>& ViewportUiWidgetCallbacks::GetWidgets() const
+    {
+        return m_widgets;
+    }
 } // namespace AzToolsFramework::ViewportUi::Internal