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