From 011c1e858f2b95297537dca74443edcbbf65c15e Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Sat, 4 Jul 2026 15:20:14 +0800 Subject: [PATCH] feat: update the layout of main window. update the layout of main window to make it looks more like legacy Windows Photo Viewer. --- app/framelesswindow.cpp | 6 +++++- app/mainwindow.cpp | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/framelesswindow.cpp b/app/framelesswindow.cpp index 5f3d325..70aa5cd 100644 --- a/app/framelesswindow.cpp +++ b/app/framelesswindow.cpp @@ -17,7 +17,11 @@ FramelessWindow::FramelessWindow(QWidget *parent) { this->setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); - m_centralLayout->setContentsMargins(QMargins()); + // YYC MARK: + // 72 px is the height of Windows Photo Viewer's bottom line. + + // TODO: This value may be declared as a constant. + m_centralLayout->setContentsMargins(QMargins(0, 0, 0, 72)); } void FramelessWindow::setCentralWidget(QWidget *widget) diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp index 448d9a8..ee1b3e8 100644 --- a/app/mainwindow.cpp +++ b/app/mainwindow.cpp @@ -66,7 +66,11 @@ MainWindow::MainWindow(QWidget *parent) this->setCentralWidget(m_gv); m_nav = new NavigatorView(this); - m_nav->setFixedSize(220, 160); + // YYC MARK: + // Blumia set original value is 220 x 160. + // So if we set its height to 72 for respecting the height of Windows Photo Viewer, + // the width should be set to 99 for keeping aspect ratio. + m_nav->setFixedSize(99, 72); m_nav->setScene(scene); m_nav->setMainView(m_gv); m_nav->fitInView(m_nav->sceneRect(), Qt::KeepAspectRatio); @@ -481,7 +485,7 @@ void MainWindow::closeWindow() void MainWindow::updateWidgetsPosition() { m_bottomButtonGroup->move((width() - m_bottomButtonGroup->width()) / 2, - height() - m_bottomButtonGroup->height()); + (72 - m_bottomButtonGroup->height()) / 2 + (height() - 72)); m_nav->move(width() - m_nav->width(), height() - m_nav->height()); }