mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Lower general settings margins, if the window is narrow
This commit is contained in:
parent
f70923f374
commit
ef5edbb3ea
1 changed files with 12 additions and 1 deletions
|
@ -25,6 +25,7 @@
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QProcessEnvironment>
|
#include <QProcessEnvironment>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QResizeEvent>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
@ -495,7 +496,17 @@ UserSettingsPage::showEvent(QShowEvent *)
|
||||||
void
|
void
|
||||||
UserSettingsPage::resizeEvent(QResizeEvent *event)
|
UserSettingsPage::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
|
mainLayout_->setContentsMargins(0, LayoutTopMargin, 0, LayoutBottomMargin);
|
||||||
|
double contentMinWidth = mainLayout_->minimumSize().width();
|
||||||
|
|
||||||
|
if (event->size().width() * 0.6 > contentMinWidth)
|
||||||
sideMargin_ = width() * 0.2;
|
sideMargin_ = width() * 0.2;
|
||||||
|
else
|
||||||
|
sideMargin_ = static_cast<double>(event->size().width() - contentMinWidth) / 2.;
|
||||||
|
|
||||||
|
if (sideMargin_ < 40)
|
||||||
|
sideMargin_ = 0;
|
||||||
|
|
||||||
mainLayout_->setContentsMargins(
|
mainLayout_->setContentsMargins(
|
||||||
sideMargin_, LayoutTopMargin, sideMargin_, LayoutBottomMargin);
|
sideMargin_, LayoutTopMargin, sideMargin_, LayoutBottomMargin);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue