Mercurial > minori
comparison src/gui/dialog/settings.cpp @ 69:27a19dd6cba1
*: fix up some stuff
settings: due to my own incompetence OnOK caused the entire program to crash,
now that's fixed :)
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Tue, 03 Oct 2023 03:38:25 -0400 |
parents | 2417121d894e |
children | 5ccb99bfa605 |
comparison
equal
deleted
inserted
replaced
68:2417121d894e | 69:27a19dd6cba1 |
---|---|
4 #include <QDialogButtonBox> | 4 #include <QDialogButtonBox> |
5 #include <QStackedWidget> | 5 #include <QStackedWidget> |
6 #include <QVBoxLayout> | 6 #include <QVBoxLayout> |
7 #include <QHBoxLayout> | 7 #include <QHBoxLayout> |
8 #include <QWidget> | 8 #include <QWidget> |
9 #include <QLabel> | |
9 | 10 |
10 SettingsPage::SettingsPage(QWidget* parent, QString title) : QWidget(parent) { | 11 SettingsPage::SettingsPage(QWidget* parent, QString title) : QWidget(parent) { |
11 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); | 12 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); |
12 page_title = new QLabel(title, this); | 13 page_title = new QLabel(title, this); |
13 page_title->setWordWrap(false); | 14 page_title->setWordWrap(false); |
49 void SettingsPage::SaveInfo() { | 50 void SettingsPage::SaveInfo() { |
50 // no-op... child classes will implement this | 51 // no-op... child classes will implement this |
51 } | 52 } |
52 | 53 |
53 void SettingsDialog::OnOK() { | 54 void SettingsDialog::OnOK() { |
54 QStackedWidget* stacked = reinterpret_cast<QStackedWidget*>(layout()->itemAt(1)->widget()); | |
55 for (int i = 0; i < stacked->count(); i++) { | 55 for (int i = 0; i < stacked->count(); i++) { |
56 reinterpret_cast<SettingsPage*>(stacked->widget(i))->SaveInfo(); | 56 reinterpret_cast<SettingsPage*>(stacked->widget(i))->SaveInfo(); |
57 } | 57 } |
58 QDialog::accept(); | 58 QDialog::accept(); |
59 } | 59 } |
78 QFont font(sidebar->font()); | 78 QFont font(sidebar->font()); |
79 font.setPointSize(9); | 79 font.setPointSize(9); |
80 sidebar->setFont(font); | 80 sidebar->setFont(font); |
81 | 81 |
82 QPalette pal(sidebar->palette()); | 82 QPalette pal(sidebar->palette()); |
83 pal.setColor(QPalette::Base, pal.color(QPalette::Window)); | 83 sidebar->SetBackgroundColor(pal.color(QPalette::Base)); |
84 sidebar->setPalette(pal); | |
85 | 84 |
86 sidebar->setFixedWidth(158); | 85 sidebar->setFixedWidth(158); |
87 sidebar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); | 86 sidebar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); |
88 | 87 |
89 QStackedWidget* stacked = new QStackedWidget(this); | 88 stacked = new QStackedWidget(this); |
90 stacked->addWidget(new SettingsPageServices(stacked)); | 89 stacked->addWidget(new SettingsPageServices(stacked)); |
91 stacked->addWidget(new SettingsPageApplication(stacked)); | 90 stacked->addWidget(new SettingsPageApplication(stacked)); |
92 stacked->setCurrentIndex(0); | 91 stacked->setCurrentIndex(0); |
93 | 92 |
94 connect(sidebar, &QListWidget::currentRowChanged, stacked, &QStackedWidget::setCurrentIndex); | 93 connect(sidebar, &QListWidget::currentRowChanged, stacked, &QStackedWidget::setCurrentIndex); |