From b22a1843375014023838a4e5e1ab1b7081fb98a7 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Fri, 10 Jul 2020 20:27:10 +0300 Subject: [PATCH] improve positioning for primary/secconfigviews --- app/view/settings/primaryconfigview.cpp | 11 ++++++----- app/view/settings/secondaryconfigview.cpp | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/view/settings/primaryconfigview.cpp b/app/view/settings/primaryconfigview.cpp index 883adee4c..10a15f9b7 100644 --- a/app/view/settings/primaryconfigview.cpp +++ b/app/view/settings/primaryconfigview.cpp @@ -267,8 +267,9 @@ void PrimaryConfigView::syncGeometry() const auto location = m_latteView->containment()->location(); const auto scrGeometry = m_latteView->screenGeometry(); const auto availGeometry = m_availableScreenGeometry; + const auto canvasGeometry = m_latteView->positioner()->canvasGeometry(); - int clearThickness = m_latteView->editThickness(); + int canvasThickness = m_latteView->formFactor() == Plasma::Types::Vertical ? canvasGeometry.width() : canvasGeometry.height(); QPoint position{0, 0}; @@ -288,19 +289,19 @@ void PrimaryConfigView::syncGeometry() } if (location == Plasma::Types::TopEdge) { - yPos = scrGeometry.y() + clearThickness; + yPos = scrGeometry.y() + canvasThickness; } else if (location == Plasma::Types::BottomEdge) { - yPos = scrGeometry.y() + scrGeometry.height() - clearThickness - size.height(); + yPos = scrGeometry.y() + scrGeometry.height() - canvasThickness - size.height(); } } break; case Plasma::Types::Vertical: { if (location == Plasma::Types::LeftEdge) { - xPos = scrGeometry.x() + clearThickness; + xPos = scrGeometry.x() + canvasThickness; yPos = availGeometry.y() + (availGeometry.height() - size.height())/2; } else if (location == Plasma::Types::RightEdge) { - xPos = scrGeometry.x() + scrGeometry.width() - clearThickness - size.width(); + xPos = scrGeometry.x() + scrGeometry.width() - canvasThickness - size.width(); yPos = availGeometry.y() + (availGeometry.height() - size.height())/2; } } diff --git a/app/view/settings/secondaryconfigview.cpp b/app/view/settings/secondaryconfigview.cpp index e656c7aab..368821612 100644 --- a/app/view/settings/secondaryconfigview.cpp +++ b/app/view/settings/secondaryconfigview.cpp @@ -111,8 +111,9 @@ void SecondaryConfigView::syncGeometry() const auto location = m_latteView->containment()->location(); const auto scrGeometry = m_latteView->screenGeometry(); const auto availGeometry = m_parent->availableScreenGeometry(); + const auto canvasGeometry = m_latteView->positioner()->canvasGeometry(); - int clearThickness = m_latteView->editThickness(); + int canvasThickness = m_latteView->formFactor() == Plasma::Types::Vertical ? canvasGeometry.width() : canvasGeometry.height(); int secondaryConfigSpacing = 2 * m_latteView->fontPixelSize(); @@ -130,9 +131,9 @@ void SecondaryConfigView::syncGeometry() } if (location == Plasma::Types::TopEdge) { - yPos = scrGeometry.y() + clearThickness; + yPos = scrGeometry.y() + canvasThickness; } else if (location == Plasma::Types::BottomEdge) { - yPos = scrGeometry.y() + scrGeometry.height() - clearThickness - size.height(); + yPos = scrGeometry.y() + scrGeometry.height() - canvasThickness - size.height(); } } break; @@ -141,9 +142,9 @@ void SecondaryConfigView::syncGeometry() yPos = availGeometry.y() + secondaryConfigSpacing; if (location == Plasma::Types::LeftEdge) { - xPos = scrGeometry.x() + clearThickness; + xPos = scrGeometry.x() + canvasThickness; } else if (location == Plasma::Types::RightEdge) { - xPos = scrGeometry.x() + scrGeometry.width() - clearThickness - size.width(); + xPos = scrGeometry.x() + scrGeometry.width() - canvasThickness - size.width(); } } break;