Skip to content

Commit 80e1531

Browse files
committed
[GUI] Open the app's window in the smallest, currently available, size.
1 parent 441d790 commit 80e1531

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/qt/pivx/pivxgui.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "qt/pivx/defaultdialog.h"
1919
#include "qt/pivx/settings/settingsfaqwidget.h"
2020

21+
#include <QDesktopWidget>
2122
#include <QHBoxLayout>
2223
#include <QVBoxLayout>
2324
#include <QApplication>
@@ -42,7 +43,16 @@ PIVXGUI::PIVXGUI(const NetworkStyle* networkStyle, QWidget* parent) :
4243
/* Open CSS when configured */
4344
this->setStyleSheet(GUIUtil::loadStyleSheet());
4445
this->setMinimumSize(BASE_WINDOW_WIDTH, BASE_WINDOW_MIN_HEIGHT);
45-
GUIUtil::restoreWindowGeometry("nWindow", QSize(BASE_WINDOW_WIDTH, BASE_WINDOW_HEIGHT), this);
46+
47+
48+
// Adapt screen size
49+
QRect rec = QApplication::desktop()->screenGeometry();
50+
int adaptedHeight = (rec.height() < BASE_WINDOW_HEIGHT) ? BASE_WINDOW_MIN_HEIGHT : BASE_WINDOW_HEIGHT;
51+
GUIUtil::restoreWindowGeometry(
52+
"nWindow",
53+
QSize(BASE_WINDOW_WIDTH, adaptedHeight),
54+
this
55+
);
4656

4757
#ifdef ENABLE_WALLET
4858
/* if compiled with wallet support, -disablewallet can still disable the wallet */

0 commit comments

Comments
 (0)