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.
This commit is contained in:
parent
c5d692843f
commit
6c67b73b7d
1 changed files with 3 additions and 3 deletions
|
@ -39,16 +39,16 @@ public:
|
||||||
void updateScreenGraphics()
|
void updateScreenGraphics()
|
||||||
{
|
{
|
||||||
int bottomElements = screenGraphics->elementSize("base").height() + screenGraphics->marginSize(KSvg::FrameSvg::BottomMargin);
|
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);
|
monitorSize.scale(bounds.size(), Qt::KeepAspectRatio);
|
||||||
|
|
||||||
if (monitorSize.isEmpty()) {
|
if (monitorSize.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
monitorRect = QRect(QPoint(0, 0), monitorSize);
|
monitorRect = QRect(QPoint(0, 0), monitorSize.toSize());
|
||||||
monitorRect.moveCenter(bounds.center());
|
monitorRect.moveCenter(bounds.center());
|
||||||
|
|
||||||
screenGraphics->resizeFrame(monitorRect.size());
|
screenGraphics->resizeFrame(monitorRect.size());
|
||||||
|
|
Loading…
Reference in a new issue