qt: Window coordinates are saved properly again

This commit is contained in:
Cacodemon345
2022-07-12 17:28:05 +06:00
parent 8f24c972e7
commit 9b13df7c3d

View File

@@ -229,6 +229,7 @@ MainWindow::MainWindow(QWidget *parent) :
}); });
connect(this, &MainWindow::resizeContents, this, [this](int w, int h) { connect(this, &MainWindow::resizeContents, this, [this](int w, int h) {
ui->stackedWidget->setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
if (!QApplication::platformName().contains("eglfs") && vid_resize != 1) { if (!QApplication::platformName().contains("eglfs") && vid_resize != 1) {
w = (w / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.)); w = (w / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.));
@@ -630,7 +631,6 @@ MainWindow::~MainWindow() {
void MainWindow::showEvent(QShowEvent *event) { void MainWindow::showEvent(QShowEvent *event) {
if (shownonce) return; if (shownonce) return;
shownonce = true; shownonce = true;
if (window_remember) resize(window_w, window_h + menuBar()->height() + (hide_status_bar ? 0 : statusBar()->height()) + (hide_tool_bar ? 0 : ui->toolBar->height()));
if (window_remember && !QApplication::platformName().contains("wayland")) { if (window_remember && !QApplication::platformName().contains("wayland")) {
setGeometry(window_x, window_y, window_w, window_h + menuBar()->height() + (hide_status_bar ? 0 : statusBar()->height()) + (hide_tool_bar ? 0 : ui->toolBar->height())); setGeometry(window_x, window_y, window_w, window_h + menuBar()->height() + (hide_status_bar ? 0 : statusBar()->height()) + (hide_tool_bar ? 0 : ui->toolBar->height()));
} }
@@ -645,10 +645,8 @@ void MainWindow::showEvent(QShowEvent *event) {
} }
if (window_remember && vid_resize == 1) { if (window_remember && vid_resize == 1) {
ui->stackedWidget->setFixedSize(window_w, window_h); ui->stackedWidget->setFixedSize(window_w, window_h);
adjustSize(); QApplication::processEvents();
ui->stackedWidget->setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); this->adjustSize();
monitors[0].mon_scrnsz_x = window_w;
monitors[0].mon_scrnsz_y = window_h;
} }
} }