@@ -18,43 +18,72 @@ namespace AzToolsFramework
18
18
19
19
void ContainerActionButtonHandler::SetValueFromDom (const AZ::Dom::Value& node)
20
20
{
21
- GenericButtonHandler::SetValueFromDom (node);
22
21
23
- static QIcon s_iconAdd (QStringLiteral (" :/stylesheet/img/UI20/add-16.svg" ));
24
- static QIcon s_iconRemove (QStringLiteral (" :/stylesheet/img/UI20/delete-16.svg" ));
25
- static QIcon s_iconClear (QStringLiteral (" :/stylesheet/img/UI20/delete-16.svg" ));
26
- static QIcon s_iconUp (QStringLiteral (" :/stylesheet/img/indicator-arrow-up.svg" ));
27
- static QIcon s_iconDown (QStringLiteral (" :/stylesheet/img/indicator-arrow-down.svg" ));
22
+ static const QIcon s_iconAdd (QStringLiteral (" :/stylesheet/img/UI20/add-16.svg" ));
23
+ static const QIcon s_iconRemove (QStringLiteral (" :/stylesheet/img/UI20/delete-16.svg" ));
24
+ static const QIcon s_iconClear (QStringLiteral (" :/stylesheet/img/UI20/delete-16.svg" ));
25
+ static const QIcon s_iconUp (QStringLiteral (" :/stylesheet/img/indicator-arrow-up.svg" ));
26
+ static const QIcon s_iconDown (QStringLiteral (" :/stylesheet/img/indicator-arrow-down.svg" ));
28
27
29
28
using AZ::DocumentPropertyEditor::Nodes::ContainerAction;
30
29
using AZ::DocumentPropertyEditor::Nodes::ContainerActionButton;
31
30
31
+ GenericButtonHandler::SetValueFromDom (node);
32
+
33
+ auto oldAction = m_action;
32
34
m_action = ContainerActionButton::Action.ExtractFromDomNode (node).value_or (ContainerAction::AddElement);
35
+
36
+ if (m_action == oldAction)
37
+ {
38
+ return ;
39
+ }
40
+
33
41
switch (m_action)
34
42
{
35
43
case ContainerAction::AddElement:
36
- setIcon (s_iconAdd);
37
- setToolTip (" Add new child element" );
38
- break ;
44
+ {
45
+ setIcon (s_iconAdd);
46
+ setToolTip (tr (" Add new child element" ));
47
+ break ;
48
+ }
39
49
case ContainerAction::RemoveElement:
40
- setIcon (s_iconRemove);
41
- setToolTip (tr (" Remove this element" ));
42
- break ;
50
+ {
51
+ setIcon (s_iconRemove);
52
+ setToolTip (tr (" Remove this element" ));
53
+ break ;
54
+ }
43
55
case ContainerAction::Clear:
44
- setIcon (s_iconClear);
45
- setToolTip (tr (" Remove all elements" ));
46
- break ;
56
+ {
57
+ setIcon (s_iconClear);
58
+ setToolTip (tr (" Remove all elements" ));
59
+ break ;
60
+ }
47
61
case ContainerAction::MoveUp:
48
- setIcon (s_iconUp);
49
- setToolTip (tr (" move this element up" ));
50
- break ;
62
+ {
63
+ setIcon (s_iconUp);
64
+ setToolTip (tr (" move this element up" ));
65
+ break ;
66
+ }
51
67
case ContainerAction::MoveDown:
52
- setIcon (s_iconDown);
53
- setToolTip (tr (" move this element down" ));
54
- break ;
68
+ {
69
+ setIcon (s_iconDown);
70
+ setToolTip (tr (" move this element down" ));
71
+ break ;
72
+ }
73
+ case ContainerAction::None:
74
+ default :
75
+ {
76
+ AZ_Error (" DPE" , false , " ContainerActionButtonHandler::SetValueFromDom passed invalid action!" );
77
+ break ;
78
+ }
55
79
}
56
80
}
57
81
82
+ bool ContainerActionButtonHandler::ResetToDefaults ()
83
+ {
84
+ return GenericButtonHandler::ResetToDefaults ();
85
+ }
86
+
58
87
void ContainerActionButtonHandler::OnClicked ()
59
88
{
60
89
using AZ::DocumentPropertyEditor::Nodes::Container;
0 commit comments