bugfix: prevent Anchor buttons from overlapping when shrinking layout (#5552)
Signed-off-by: Michael Pollind <mpollind@gmail.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user