From 53ba07d898252e057678b2294ebd7eef80e719c4 Mon Sep 17 00:00:00 2001 From: Michael Pollind Date: Sun, 21 Nov 2021 00:19:46 -0800 Subject: [PATCH 1/2] bugfix: prevent Anchor buttons from overlapping when shrinking layout (#5552) Signed-off-by: Michael Pollind --- Gems/LyShine/Code/Editor/AnchorPresetsWidget.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gems/LyShine/Code/Editor/AnchorPresetsWidget.cpp b/Gems/LyShine/Code/Editor/AnchorPresetsWidget.cpp index ca3701743e..bc6d73984a 100644 --- a/Gems/LyShine/Code/Editor/AnchorPresetsWidget.cpp +++ b/Gems/LyShine/Code/Editor/AnchorPresetsWidget.cpp @@ -18,7 +18,7 @@ #define UICANVASEDITOR_ANCHOR_ICON_PATH_SELECTED(presetIndex) (QString(":/Icons/AnchorIcon%1Selected.tif").arg(presetIndex, 2, 10, QChar('0'))) #define UICANVASEDITOR_ANCHOR_WIDGET_FIXED_SIZE (106) -#define UICANVASEDITOR_ANCHOR_BUTTON_AND_ICON_FIXED_SIZE (20) +#define UICANVASEDITOR_ANCHOR_BUTTON_AND_ICON_FIXED_SIZE (15) AnchorPresetsWidget::AnchorPresetsWidget(int defaultPresetIndex, PresetChanger presetChanger, @@ -27,8 +27,6 @@ AnchorPresetsWidget::AnchorPresetsWidget(int defaultPresetIndex, , m_presetIndex(defaultPresetIndex) , m_buttons(AnchorPresets::PresetIndexCount, nullptr) { - setFixedSize(UICANVASEDITOR_ANCHOR_WIDGET_FIXED_SIZE, UICANVASEDITOR_ANCHOR_WIDGET_FIXED_SIZE); - // The layout. QGridLayout* grid = new QGridLayout(this); grid->setContentsMargins(0, 0, 0, 0); @@ -38,6 +36,7 @@ AnchorPresetsWidget::AnchorPresetsWidget(int defaultPresetIndex, { for (int presetIndex = 0; presetIndex < AnchorPresets::PresetIndexCount; ++presetIndex) { + QLayout* boxLayout = new QVBoxLayout(); PresetButton* button = new PresetButton(UICANVASEDITOR_ANCHOR_ICON_PATH_DEFAULT(presetIndex), UICANVASEDITOR_ANCHOR_ICON_PATH_HOVER(presetIndex), UICANVASEDITOR_ANCHOR_ICON_PATH_SELECTED(presetIndex), @@ -50,8 +49,9 @@ AnchorPresetsWidget::AnchorPresetsWidget(int defaultPresetIndex, presetChanger(presetIndex); }, this); - - grid->addWidget(button, (presetIndex / 4), (presetIndex % 4)); + boxLayout->addWidget(button); + boxLayout->setContentsMargins(4,4,4,4); + grid->addItem(boxLayout, (presetIndex / 4), (presetIndex % 4)); m_buttons[ presetIndex ] = button; } From ce38e805bfe2849295460d6058d09944379ea241 Mon Sep 17 00:00:00 2001 From: Michael Pollind Date: Sun, 21 Nov 2021 08:18:25 -0800 Subject: [PATCH 2/2] chore: change minimum width and change fixed size Signed-off-by: Michael Pollind --- Gems/LyShine/Code/Editor/AnchorPresetsWidget.cpp | 4 ++-- Gems/LyShine/Code/Editor/PropertiesWidget.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gems/LyShine/Code/Editor/AnchorPresetsWidget.cpp b/Gems/LyShine/Code/Editor/AnchorPresetsWidget.cpp index bc6d73984a..84ff2e19a7 100644 --- a/Gems/LyShine/Code/Editor/AnchorPresetsWidget.cpp +++ b/Gems/LyShine/Code/Editor/AnchorPresetsWidget.cpp @@ -18,7 +18,7 @@ #define UICANVASEDITOR_ANCHOR_ICON_PATH_SELECTED(presetIndex) (QString(":/Icons/AnchorIcon%1Selected.tif").arg(presetIndex, 2, 10, QChar('0'))) #define UICANVASEDITOR_ANCHOR_WIDGET_FIXED_SIZE (106) -#define UICANVASEDITOR_ANCHOR_BUTTON_AND_ICON_FIXED_SIZE (15) +#define UICANVASEDITOR_ANCHOR_BUTTON_AND_ICON_FIXED_SIZE (20) AnchorPresetsWidget::AnchorPresetsWidget(int defaultPresetIndex, PresetChanger presetChanger, @@ -50,7 +50,7 @@ AnchorPresetsWidget::AnchorPresetsWidget(int defaultPresetIndex, }, this); boxLayout->addWidget(button); - boxLayout->setContentsMargins(4,4,4,4); + boxLayout->setContentsMargins(2, 2, 2, 2); grid->addItem(boxLayout, (presetIndex / 4), (presetIndex % 4)); m_buttons[ presetIndex ] = button; diff --git a/Gems/LyShine/Code/Editor/PropertiesWidget.cpp b/Gems/LyShine/Code/Editor/PropertiesWidget.cpp index c128fe15b9..e350a367c6 100644 --- a/Gems/LyShine/Code/Editor/PropertiesWidget.cpp +++ b/Gems/LyShine/Code/Editor/PropertiesWidget.cpp @@ -49,7 +49,7 @@ PropertiesWidget::PropertiesWidget(EditorWindow* editorWindow, m_refreshTimer.setSingleShot(true); } - setMinimumWidth(250); + setMinimumWidth(330); ToolsApplicationEvents::Bus::Handler::BusConnect(); }