mirror of
https://github.com/Rosalie241/RMG.git
synced 2026-07-11 01:24:01 +02:00
RMG-Input: allow middle widget in AlignCenterLayout to have 40% of width
This commit is contained in:
@@ -81,7 +81,7 @@ void AlignCenterLayout::setGeometry(const QRect& rect)
|
||||
|
||||
|
||||
// the side widgets are limited to 25% of available width
|
||||
// the middle widget is limited to 1/3rd of the available width
|
||||
// the middle widget is limited to 40% of the available width
|
||||
//
|
||||
// this also takes into account the situation where there's an overlap
|
||||
// between widgets, which is something this avoids.
|
||||
@@ -89,7 +89,7 @@ void AlignCenterLayout::setGeometry(const QRect& rect)
|
||||
const int itemHeight = centerItem->minimumSize().height() + spacing;
|
||||
const int rectWidth = rect.width();
|
||||
const int topLocation = rect.y() + spacing;
|
||||
const int centerItemWidth = std::min(centerItem->sizeHint().width(), rectWidth / 3);
|
||||
const int centerItemWidth = std::min(centerItem->sizeHint().width(), static_cast<int>(std::ceil(rectWidth / 2.5)));
|
||||
const int centerItemLocation = ((rectWidth / 2)) - (centerItemWidth / 2);
|
||||
const int maxSideItemWidth = std::min(centerItemLocation, rectWidth / 4) - spacing;
|
||||
const int sideItemWidth = std::min(leftItem->minimumSize().width(), maxSideItemWidth);
|
||||
|
||||
Reference in New Issue
Block a user