Refactored duplicate code.

This commit is contained in:
Leonardo Zide
2020-12-18 12:15:35 -08:00
parent dcf8ddfd95
commit baa0a70de2
9 changed files with 60 additions and 97 deletions
+3 -2
View File
@@ -135,13 +135,14 @@ void lcViewWidget::SetPreviewPosition(const QRect& ParentRect)
pos = mapToGlobal(ParentRect.bottomLeft());
break;
}
if (pos.x() < desktop.left())
pos.setX(desktop.left());
if (pos.y() < desktop.top())
pos.setY(desktop.top());
if ((pos.x() + width()) > desktop.width())
pos.setX(desktop.width() - width());
if ((pos.x() + width()) > desktop.right())
pos.setX(desktop.right() - width());
if ((pos.y() + height()) > desktop.bottom())
pos.setY(desktop.bottom() - height());
move(pos);