Use resize margin - disallow users from resizing to the size of the parent container

This commit is contained in:
Syarif Fakhri 2022-10-28 14:24:44 +08:00
parent 2a97833d02
commit ee2ef8ac69

View File

@ -47,7 +47,7 @@
namespace ads namespace ads
{ {
static const int ResizeMargin = 4; static const int ResizeMargin = 30;
//============================================================================ //============================================================================
bool static isHorizontalArea(SideBarLocation Area) bool static isHorizontalArea(SideBarLocation Area)
@ -136,8 +136,9 @@ struct AutoHideDockContainerPrivate
void updateResizeHandleSizeLimitMax() void updateResizeHandleSizeLimitMax()
{ {
auto Rect = _this->parentContainer()->contentRect(); auto Rect = _this->parentContainer()->contentRect();
ResizeHandle->setMaxResizeSize(ResizeHandle->orientation() == Qt::Horizontal const auto maxResizeHandleSize = ResizeHandle->orientation() == Qt::Horizontal
? Rect.width() : Rect.height()); ? Rect.width() : Rect.height();
ResizeHandle->setMaxResizeSize(maxResizeHandleSize - ResizeMargin);
} }
/** /**
@ -218,18 +219,18 @@ void CAutoHideDockContainer::updateSize()
switch (sideTabBarArea()) switch (sideTabBarArea())
{ {
case SideBarLocation::Top: case SideBarLocation::Top:
resize(rect.width(), qMin(rect.height(), d->Size.height())); resize(rect.width(), qMin(rect.height(), d->Size.height() - ResizeMargin));
move(rect.topLeft()); move(rect.topLeft());
break; break;
case SideBarLocation::Left: case SideBarLocation::Left:
resize(qMin(d->Size.width(), rect.width()), rect.height()); resize(qMin(d->Size.width(), rect.width() - ResizeMargin), rect.height());
move(rect.topLeft()); move(rect.topLeft());
break; break;
case SideBarLocation::Right: case SideBarLocation::Right:
{ {
resize(qMin(d->Size.width(), rect.width()), rect.height()); resize(qMin(d->Size.width(), rect.width() - ResizeMargin), rect.height());
QPoint p = rect.topRight(); QPoint p = rect.topRight();
p.rx() -= (width() - 1); p.rx() -= (width() - 1);
move(p); move(p);
@ -238,7 +239,7 @@ void CAutoHideDockContainer::updateSize()
case SideBarLocation::Bottom: case SideBarLocation::Bottom:
{ {
resize(rect.width(), qMin(rect.height(), d->Size.height())); resize(rect.width(), qMin(rect.height(), d->Size.height() - ResizeMargin));
QPoint p = rect.bottomLeft(); QPoint p = rect.bottomLeft();
p.ry() -= (height() - 1); p.ry() -= (height() - 1);
move(p); move(p);