[LY-113714]

Jira: LY-113714
https://jira.agscollab.com/browse/LY-113714
This commit is contained in:
sphrose
2021-04-13 17:15:10 +01:00
parent 5de3ff4c61
commit a71a5746cc
7 changed files with 61 additions and 1 deletions
@@ -62,6 +62,8 @@ namespace AZ
const static AZ::Crc32 ButtonTooltip = AZ_CRC("ButtonTooltip", 0x1605a7d2);
const static AZ::Crc32 CheckboxTooltip = AZ_CRC("CheckboxTooltip", 0x1159eb78);
const static AZ::Crc32 CheckboxDefaultValue = AZ_CRC("CheckboxDefaultValue", 0x03f117e6);
//! Emboldens the text and adds a line above this item within the RPE.
const static AZ::Crc32 RPESectionSeparator = AZ_CRC("RPESectionSeparator", 0xc6249a95);
//! Affects the display order of a node relative to it's parent/children. Higher values display further down (after) lower values. Default is 0, negative values are allowed. Must be applied as an attribute to the EditorData element
const static AZ::Crc32 DisplayOrder = AZ_CRC("DisplayOrder", 0x23660ec2);
//! Specifies whether the UI should support multi-edit for aggregate instances of this property
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="25px" height="3px" viewBox="0 0 25 3" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>line</title>
<g id="line" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<line x1="0" y1="1" x2="25" y2="1" id="Line-5" stroke="#484C4E"></line>
</g>
</svg>

After

Width:  |  Height:  |  Size: 382 B

@@ -627,6 +627,7 @@
<file alias="Settings.svg">img/UI20/Settings.svg</file>
<file alias="Asset_Folder.svg">img/UI20/Asset_Folder.svg</file>
<file alias="Asset_File.svg">img/UI20/Asset_File.svg</file>
<file alias="line.svg">img/UI20/line.svg</file>
</qresource>
<qresource prefix="/AssetEditor">
<file alias="default_document.svg">img/UI20/AssetEditor/default_document.svg</file>
@@ -44,6 +44,24 @@ namespace AzToolsFramework
m_iconOpen = s_iconOpen;
m_iconClosed = s_iconClosed;
m_outerLayout = new QVBoxLayout(nullptr);
m_outerLayout->setSpacing(0);
m_outerLayout->setContentsMargins(0, 0, 0, 0);
// separatorLayout will contain a spacer and a separator line. The width of the spacer is adjusted later to ensure the line is the
// correct length.
QHBoxLayout* separatorLayout = new QHBoxLayout(nullptr);
m_outerLayout->addLayout(separatorLayout);
m_separatorIndent = new QSpacerItem(1, 1);
separatorLayout->addItem(m_separatorIndent);
m_separatorLine.load(QStringLiteral(":/Gallery/line.svg"));
m_separatorLine.setFixedHeight(3);
separatorLayout->addWidget(&m_separatorLine);
m_separatorLine.setVisible(false);
m_mainLayout = new QHBoxLayout();
m_mainLayout->setSpacing(0);
m_mainLayout->setContentsMargins(0, 1, 0, 1);
@@ -118,7 +136,8 @@ namespace AzToolsFramework
m_handler = nullptr;
m_containerSize = 0;
setLayout(m_mainLayout);
m_outerLayout->addLayout(m_mainLayout);
setLayout(m_outerLayout);
}
bool PropertyRowWidget::HasChildWidgetAlready() const
@@ -301,6 +320,9 @@ namespace AzToolsFramework
}
}
m_isSectionSeparator = false;
m_separatorLine.setVisible(false);
RefreshAttributesFromNode(true);
// --------------------- HANDLER discovery:
@@ -946,6 +968,11 @@ namespace AzToolsFramework
{
HandleChangeNotifyAttribute(reader, m_sourceNode ? m_sourceNode->GetParent() : nullptr, m_editingCompleteNotifiers);
}
else if (attributeName == AZ::Edit::Attributes::RPESectionSeparator)
{
m_separatorLine.setVisible(true);
m_isSectionSeparator = true;
}
}
void PropertyRowWidget::SetReadOnlyQueryFunction(const ReadOnlyQueryFunction& readOnlyQueryFunction)
@@ -1070,6 +1097,7 @@ namespace AzToolsFramework
{
m_dropDownArrow->hide();
}
m_separatorIndent->changeSize((m_treeDepth * m_treeIndentation) + m_leafIndentation, 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_indent->changeSize((m_treeDepth * m_treeIndentation) + m_leafIndentation, 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_leftHandSideLayout->invalidate();
m_leftHandSideLayout->update();
@@ -1085,6 +1113,7 @@ namespace AzToolsFramework
connect(m_dropDownArrow, &QCheckBox::clicked, this, &PropertyRowWidget::OnClickedExpansionButton);
}
m_dropDownArrow->show();
m_separatorIndent->changeSize((m_treeDepth * m_treeIndentation), 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_indent->changeSize((m_treeDepth * m_treeIndentation), 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_leftHandSideLayout->invalidate();
m_leftHandSideLayout->update();
@@ -1095,6 +1124,7 @@ namespace AzToolsFramework
void PropertyRowWidget::SetIndentSize(int w)
{
m_separatorIndent->changeSize(w, 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_indent->changeSize(w, 1, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_leftHandSideLayout->invalidate();
m_leftHandSideLayout->update();
@@ -1318,6 +1348,11 @@ namespace AzToolsFramework
return canBeTopLevel(this);
}
bool PropertyRowWidget::IsSectionSeparator() const
{
return m_isSectionSeparator;
}
bool PropertyRowWidget::GetAppendDefaultLabelToName()
{
return false;
@@ -25,6 +25,7 @@ AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // class '...' needs t
#include <QtWidgets/QCheckBox>
#include <QtWidgets/QFrame>
#include <QtCore/QPointer>
#include <QSvgWidget>
#include <QtCore/QElapsedTimer>
AZ_POP_DISABLE_WARNING
@@ -44,6 +45,7 @@ namespace AzToolsFramework
Q_PROPERTY(bool hasChildRows READ HasChildRows);
Q_PROPERTY(bool isTopLevel READ IsTopLevel);
Q_PROPERTY(int getLevel READ GetLevel);
Q_PROPERTY(bool isSectionSeparator READ IsSectionSeparator);
Q_PROPERTY(bool appendDefaultLabelToName READ GetAppendDefaultLabelToName WRITE AppendDefaultLabelToName)
public:
AZ_CLASS_ALLOCATOR(PropertyRowWidget, AZ::SystemAllocator, 0)
@@ -82,6 +84,7 @@ namespace AzToolsFramework
PropertyRowWidget* GetParentRow() const { return m_parentRow; }
int GetLevel() const;
bool IsTopLevel() const;
bool IsSectionSeparator() const;
// Remove the default label and append the text to the name label.
bool GetAppendDefaultLabelToName();
@@ -161,6 +164,9 @@ namespace AzToolsFramework
QHBoxLayout* m_leftHandSideLayout;
QHBoxLayout* m_middleLayout;
QHBoxLayout* m_rightHandSideLayout;
QVBoxLayout* m_outerLayout;
QSvgWidget m_separatorLine;
QSpacerItem* m_separatorIndent;
QPointer <QCheckBox> m_dropDownArrow;
QPointer <QToolButton> m_containerClearButton;
@@ -229,6 +235,8 @@ namespace AzToolsFramework
int m_treeIndentation = 14;
int m_leafIndentation = 16;
bool m_isSectionSeparator = false;
QIcon m_iconOpen;
QIcon m_iconClosed;