improve positioning for primary/secconfigviews

pull/18/head
Michail Vourlakos 5 years ago
parent 8fabeb83ed
commit b22a184337

@ -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;
}
}

@ -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;

Loading…
Cancel
Save