kcms/screenedges: Slightly refactor monitor size calculation

It doesn't need width when it's going to be scaled with KeepAspectRatio
to some other rectangle anyway, so using constant 1.0 makes it clearer.
master
ivan tkachenko 11 months ago
parent c5d692843f
commit 6c67b73b7d
No known key found for this signature in database
GPG Key ID: AF72731B7C654CB3

@ -39,16 +39,16 @@ public:
void updateScreenGraphics()
{
int bottomElements = screenGraphics->elementSize("base").height() + screenGraphics->marginSize(KSvg::FrameSvg::BottomMargin);
QRect bounds(QPoint(0, 0), QSize(q->size().width(), q->height() - bottomElements));
QRect bounds(QPoint(0, 0), QSize(q->width(), q->height() - bottomElements));
QSize monitorSize(q->size().width(), q->size().width() / ratio);
QSizeF monitorSize(1.0, 1.0 / ratio);
monitorSize.scale(bounds.size(), Qt::KeepAspectRatio);
if (monitorSize.isEmpty()) {
return;
}
monitorRect = QRect(QPoint(0, 0), monitorSize);
monitorRect = QRect(QPoint(0, 0), monitorSize.toSize());
monitorRect.moveCenter(bounds.center());
screenGraphics->resizeFrame(monitorRect.size());

Loading…
Cancel
Save