Move Qt Toast Notifications from GraphCanvas into Framework

Move the existing Qt Toast Notification QWidgets, EBuses and logic from the GraphCanvas gem into AzQtComponents and AzToolsFramework so they can be re-used.

Signed-off-by: AMZN-alexpete <26804013+AMZN-alexpete@users.noreply.github.com>
This commit is contained in:
Alex Peterson
2021-10-20 11:15:24 -07:00
committed by GitHub
parent 67532ed18f
commit 7ddcdffed7
25 changed files with 514 additions and 381 deletions
@@ -13,6 +13,8 @@
#include <AzCore/Serialization/EditContext.h>
#include <AzQtComponents/Components/ToastNotification.h>
#include <Components/Connections/ConnectionComponent.h>
#include <Components/Connections/ConnectionLayerControllerComponent.h>
@@ -1117,10 +1119,8 @@ namespace GraphCanvas
QPointF globalConnectionPoint = ConversionUtils::AZToQPoint(globalConnectionVector);
QPointF anchorPoint(0.0f, 0.0f);
ToastConfiguration toastConfiguration(ToastType::Error, "Unable to connect to slot", m_validationResult.m_failureReason);
toastConfiguration.SetCloseOnClick(false);
AzQtComponents::ToastConfiguration toastConfiguration(AzQtComponents::ToastType::Error, "Unable to connect to slot", m_validationResult.m_failureReason.c_str());
toastConfiguration.m_closeOnClick = false;
m_toastId = viewHandler->ShowToastAtPoint(globalConnectionPoint.toPoint(), anchorPoint, toastConfiguration);
}
@@ -19,6 +19,7 @@ AZ_POP_DISABLE_WARNING
#include <AzCore/Component/EntityBus.h>
#include <AzCore/std/string/string.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <AzToolsFramework/UI/Notifications/ToastBus.h>
#include <GraphCanvas/Components/Connections/ConnectionBus.h>
#include <GraphCanvas/Components/GeometryBus.h>
@@ -210,7 +211,7 @@ namespace GraphCanvas
ConnectionValidationTooltip m_validationResult;
Endpoint m_endpointTooltip;
ToastId m_toastId;
AzToolsFramework::ToastId m_toastId;
//! The Id of the graph this connection belongs to.
GraphId m_graphId;
@@ -12,6 +12,8 @@
#include <qsizepolicy.h>
#include <QGraphicsSceneDragDropEvent>
#include <AzQtComponents/Components/ToastNotification.h>
#include <Components/Slots/Data/DataSlotLayoutComponent.h>
#include <Components/Slots/Data/DataSlotConnectionPin.h>
@@ -157,8 +159,8 @@ namespace GraphCanvas
anchorPoint = QPointF(1.0f, 0.5f);
}
ToastConfiguration toastConfiguration(ToastType::Error, "Unable to drop onto to slot", error);
toastConfiguration.SetCloseOnClick(false);
AzQtComponents::ToastConfiguration toastConfiguration(AzQtComponents::ToastType::Error, "Unable to drop onto to slot", error.c_str());
toastConfiguration.m_closeOnClick = false;
m_toastId = viewHandler->ShowToastAtPoint(globalConnectionPoint.toPoint(), anchorPoint, toastConfiguration);
}
@@ -10,6 +10,7 @@
#include <QGraphicsLinearLayout>
#include <QTimer>
#include <AzToolsFramework/UI/Notifications/ToastBus.h>
#include <Components/Slots/SlotLayoutComponent.h>
#include <GraphCanvas/Components/SceneBus.h>
#include <GraphCanvas/Components/Slots/SlotBus.h>
@@ -58,7 +59,7 @@ namespace GraphCanvas
SlotId m_slotId;
ViewId m_viewId;
ToastId m_toastId;
AzToolsFramework::ToastId m_toastId;
};
class DoubleClickSceneEventFilter