mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-24 05:22:06 +08:00
Fixed calculateSideTabBarArea function to work properly with every dock container
This commit is contained in:
parent
ebdd950b4e
commit
7774aaa75a
@ -1549,41 +1549,41 @@ enum eBorderLocation
|
|||||||
CDockWidgetSideTab::SideTabBarArea CDockContainerWidget::calculateSideTabBarArea(CDockAreaWidget* DockAreaWidget)
|
CDockWidgetSideTab::SideTabBarArea CDockContainerWidget::calculateSideTabBarArea(CDockAreaWidget* DockAreaWidget)
|
||||||
{
|
{
|
||||||
|
|
||||||
auto DockMgrRect = d->DockManager->contentRect();
|
auto ContentRect = this->contentRect();
|
||||||
int borders = BorderNone; // contains all borders that are touched by the dock ware
|
int borders = BorderNone; // contains all borders that are touched by the dock ware
|
||||||
auto DockAreaTopLeft = DockAreaWidget->mapTo(d->DockManager, DockAreaWidget->rect().topLeft());
|
auto DockAreaTopLeft = DockAreaWidget->mapTo(this, DockAreaWidget->rect().topLeft());
|
||||||
auto DockAreaRect = DockAreaWidget->rect();
|
auto DockAreaRect = DockAreaWidget->rect();
|
||||||
DockAreaRect.moveTo(DockAreaTopLeft);
|
DockAreaRect.moveTo(DockAreaTopLeft);
|
||||||
const qreal aspectRatio = DockAreaRect.width() / (qMax(1, DockAreaRect.height()) * 1.0);
|
const qreal aspectRatio = DockAreaRect.width() / (qMax(1, DockAreaRect.height()) * 1.0);
|
||||||
const qreal sizeRatio = (qreal)DockMgrRect.width() / DockAreaRect.width();
|
const qreal sizeRatio = (qreal)ContentRect.width() / DockAreaRect.width();
|
||||||
static const int MinBorderDistance = 16;
|
static const int MinBorderDistance = 16;
|
||||||
bool HorizontalOrientation = (aspectRatio > 1.0) && (sizeRatio < 3.0);
|
bool HorizontalOrientation = (aspectRatio > 1.0) && (sizeRatio < 3.0);
|
||||||
|
|
||||||
// measure border distances - a distance less than 16 px means we touch the
|
// measure border distances - a distance less than 16 px means we touch the
|
||||||
// border
|
// border
|
||||||
int BorderDistance[4];
|
int BorderDistance[4];
|
||||||
int Distance = qAbs(DockMgrRect.topLeft().y() - DockAreaRect.topLeft().y());
|
int Distance = qAbs(ContentRect.topLeft().y() - DockAreaRect.topLeft().y());
|
||||||
BorderDistance[CDockWidgetSideTab::Top] = (Distance < MinBorderDistance) ? 0 : Distance;
|
BorderDistance[CDockWidgetSideTab::Top] = (Distance < MinBorderDistance) ? 0 : Distance;
|
||||||
if (!BorderDistance[CDockWidgetSideTab::Top])
|
if (!BorderDistance[CDockWidgetSideTab::Top])
|
||||||
{
|
{
|
||||||
borders |= BorderTop;
|
borders |= BorderTop;
|
||||||
}
|
}
|
||||||
qDebug() << "BorderDistance[CDockWidgetSideTab::Top] " << BorderDistance[CDockWidgetSideTab::Top];
|
qDebug() << "BorderDistance[CDockWidgetSideTab::Top] " << BorderDistance[CDockWidgetSideTab::Top];
|
||||||
Distance = qAbs(DockMgrRect.bottomRight().y() - DockAreaRect.bottomRight().y());
|
Distance = qAbs(ContentRect.bottomRight().y() - DockAreaRect.bottomRight().y());
|
||||||
BorderDistance[CDockWidgetSideTab::Bottom] = (Distance < MinBorderDistance) ? 0 : Distance;
|
BorderDistance[CDockWidgetSideTab::Bottom] = (Distance < MinBorderDistance) ? 0 : Distance;
|
||||||
if (!BorderDistance[CDockWidgetSideTab::Bottom])
|
if (!BorderDistance[CDockWidgetSideTab::Bottom])
|
||||||
{
|
{
|
||||||
borders |= BorderBottom;
|
borders |= BorderBottom;
|
||||||
}
|
}
|
||||||
qDebug() << "BorderDistance[CDockWidgetSideTab::Bottom] " << BorderDistance[CDockWidgetSideTab::Bottom];
|
qDebug() << "BorderDistance[CDockWidgetSideTab::Bottom] " << BorderDistance[CDockWidgetSideTab::Bottom];
|
||||||
Distance = qAbs(DockMgrRect.topLeft().x() - DockAreaRect.topLeft().x());
|
Distance = qAbs(ContentRect.topLeft().x() - DockAreaRect.topLeft().x());
|
||||||
BorderDistance[CDockWidgetSideTab::Left] = (Distance < MinBorderDistance) ? 0 : Distance;
|
BorderDistance[CDockWidgetSideTab::Left] = (Distance < MinBorderDistance) ? 0 : Distance;
|
||||||
if (!BorderDistance[CDockWidgetSideTab::Left])
|
if (!BorderDistance[CDockWidgetSideTab::Left])
|
||||||
{
|
{
|
||||||
borders |= BorderLeft;
|
borders |= BorderLeft;
|
||||||
}
|
}
|
||||||
qDebug() << "BorderDistance[CDockWidgetSideTab::Left] " << BorderDistance[CDockWidgetSideTab::Left];
|
qDebug() << "BorderDistance[CDockWidgetSideTab::Left] " << BorderDistance[CDockWidgetSideTab::Left];
|
||||||
Distance = qAbs(DockMgrRect.bottomRight().x() - DockAreaRect.bottomRight().x());
|
Distance = qAbs(ContentRect.bottomRight().x() - DockAreaRect.bottomRight().x());
|
||||||
BorderDistance[CDockWidgetSideTab::Right] = (Distance < MinBorderDistance) ? 0 : Distance;
|
BorderDistance[CDockWidgetSideTab::Right] = (Distance < MinBorderDistance) ? 0 : Distance;
|
||||||
if (!BorderDistance[CDockWidgetSideTab::Right])
|
if (!BorderDistance[CDockWidgetSideTab::Right])
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user