This commit is contained in:
cryptozoidberg 2021-12-02 16:45:25 +01:00
parent 708fb4c40b
commit ba35377d45
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC

View file

@ -548,15 +548,29 @@ void MainWindow::restore_pos(bool consider_showed)
}
else
{
QPoint pos;
QSize sz;
pos.setX(m_config.m_window_position.first);
pos.setY(m_config.m_window_position.second);
sz.setHeight(m_config.m_window_size.first);
sz.setWidth(m_config.m_window_size.second);
this->move(pos);
this->resize(sz);
QPoint point = QApplication::desktop()->screenGeometry().bottomRight();
if (m_config.m_window_position.first + m_config.m_window_size.second > point.x() ||
m_config.m_window_position.second + m_config.m_window_size.first > point.y()
)
{
QSize sz = AUTO_VAL_INIT(sz);
sz.setHeight(770);
sz.setWidth(1200);
this->resize(sz);
store_window_pos();
//reset position(screen changed or other reason)
}
else
{
QPoint pos = AUTO_VAL_INIT(pos);
QSize sz = AUTO_VAL_INIT(sz);
pos.setX(m_config.m_window_position.first);
pos.setY(m_config.m_window_position.second);
sz.setHeight(m_config.m_window_size.first);
sz.setWidth(m_config.m_window_size.second);
this->move(pos);
this->resize(sz);
}
}
if (consider_showed)
@ -645,7 +659,7 @@ bool MainWindow::show_inital()
{
m_config = AUTO_VAL_INIT(m_config);
this->show();
QSize sz;
QSize sz = AUTO_VAL_INIT(sz);
sz.setHeight(770);
sz.setWidth(1200);
this->resize(sz);