mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 17:01:24 +12:00
Qt: Fix initial gs_frame position on multi-monitor
This commit is contained in:
parent
b812ef2771
commit
b2317543c8
4 changed files with 15 additions and 14 deletions
|
@ -135,11 +135,13 @@ void gs_frame::paintEvent(QPaintEvent *event)
|
|||
|
||||
void gs_frame::showEvent(QShowEvent *event)
|
||||
{
|
||||
// we have to calculate new window positions, since the frame is only known once the window was created
|
||||
// We have to calculate new window positions, since the frame is only known once the window was created
|
||||
const QRect available_geometry = screen()->availableGeometry();
|
||||
QPoint pos = m_initial_geometry.topLeft();
|
||||
pos.setX(std::clamp(pos.x(), available_geometry.left(), available_geometry.width() - frameGeometry().width()));
|
||||
pos.setY(std::clamp(pos.y(), available_geometry.top(), available_geometry.height() - frameGeometry().height()));
|
||||
pos.setX(std::min(std::max(pos.x() - ((frameGeometry().width() - width()) / 2), available_geometry.left()),
|
||||
available_geometry.left() + available_geometry.width() - frameGeometry().width()));
|
||||
pos.setY(std::min(std::max(pos.y() - ((frameGeometry().height() - height()) / 2), available_geometry.top()),
|
||||
available_geometry.top() + available_geometry.height() - frameGeometry().height()));
|
||||
setFramePosition(pos);
|
||||
|
||||
QWindow::showEvent(event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue