mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-29 14:18:49 +03:00
Improve settings menu layout
This commit is contained in:
parent
b586a2329c
commit
e40dab9f98
2 changed files with 19 additions and 4 deletions
|
@ -26,7 +26,8 @@
|
||||||
class Toggle;
|
class Toggle;
|
||||||
|
|
||||||
constexpr int OptionMargin = 6;
|
constexpr int OptionMargin = 6;
|
||||||
constexpr int LayoutSideMargin = 300;
|
constexpr int LayoutTopMargin = 50;
|
||||||
|
constexpr int LayoutBottomMargin = LayoutTopMargin;
|
||||||
|
|
||||||
class UserSettings
|
class UserSettings
|
||||||
{
|
{
|
||||||
|
@ -63,6 +64,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void moveBack();
|
void moveBack();
|
||||||
|
@ -71,6 +73,7 @@ signals:
|
||||||
private:
|
private:
|
||||||
// Layouts
|
// Layouts
|
||||||
QVBoxLayout *topLayout_;
|
QVBoxLayout *topLayout_;
|
||||||
|
QVBoxLayout *mainLayout_;
|
||||||
QHBoxLayout *topBarLayout_;
|
QHBoxLayout *topBarLayout_;
|
||||||
|
|
||||||
// Shared settings object.
|
// Shared settings object.
|
||||||
|
@ -78,4 +81,6 @@ private:
|
||||||
|
|
||||||
Toggle *trayToggle_;
|
Toggle *trayToggle_;
|
||||||
QComboBox *themeCombo_;
|
QComboBox *themeCombo_;
|
||||||
|
|
||||||
|
int sideMargin_ = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -107,10 +107,10 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
general_->setFont(QFont("Open Sans Bold", 17));
|
general_->setFont(QFont("Open Sans Bold", 17));
|
||||||
general_->setStyleSheet("color: #5d6565");
|
general_->setStyleSheet("color: #5d6565");
|
||||||
|
|
||||||
auto mainLayout_ = new QVBoxLayout;
|
mainLayout_ = new QVBoxLayout;
|
||||||
mainLayout_->setSpacing(7);
|
mainLayout_->setSpacing(7);
|
||||||
mainLayout_->setContentsMargins(
|
mainLayout_->setContentsMargins(
|
||||||
LayoutSideMargin, LayoutSideMargin / 6, LayoutSideMargin, LayoutSideMargin / 6);
|
sideMargin_, LayoutTopMargin, sideMargin_, LayoutBottomMargin);
|
||||||
mainLayout_->addWidget(general_, 1, Qt::AlignLeft | Qt::AlignVCenter);
|
mainLayout_->addWidget(general_, 1, Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
mainLayout_->addWidget(new HorizontalLine(this));
|
mainLayout_->addWidget(new HorizontalLine(this));
|
||||||
mainLayout_->addLayout(trayOptionLayout_);
|
mainLayout_->addLayout(trayOptionLayout_);
|
||||||
|
@ -143,3 +143,13 @@ UserSettingsPage::showEvent(QShowEvent *)
|
||||||
themeCombo_->setCurrentIndex((settings_->theme() == "default" ? 0 : 1));
|
themeCombo_->setCurrentIndex((settings_->theme() == "default" ? 0 : 1));
|
||||||
trayToggle_->setState(!settings_->isTrayEnabled()); // Treats true as "off"
|
trayToggle_->setState(!settings_->isTrayEnabled()); // Treats true as "off"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UserSettingsPage::resizeEvent(QResizeEvent *event)
|
||||||
|
{
|
||||||
|
sideMargin_ = width() * 0.2;
|
||||||
|
mainLayout_->setContentsMargins(
|
||||||
|
sideMargin_, LayoutTopMargin, sideMargin_, LayoutBottomMargin);
|
||||||
|
|
||||||
|
QWidget::resizeEvent(event);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue