forked from blue/squawk
basic theme changing
This commit is contained in:
parent
a8a7ce2538
commit
c708c33a92
8 changed files with 108 additions and 4 deletions
|
@ -1,13 +1,42 @@
|
|||
#include "pageappearance.h"
|
||||
#include "ui_pageappearance.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
PageAppearance::PageAppearance(QWidget* parent):
|
||||
QWidget(parent),
|
||||
m_ui(new Ui::PageAppearance())
|
||||
m_ui(new Ui::PageAppearance()),
|
||||
styles()
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->themeInput->addItem(tr("System"));
|
||||
styles.push_back("system");
|
||||
QStringList themes = QStyleFactory::keys();
|
||||
for (const QString& key : themes) {
|
||||
m_ui->themeInput->addItem(key);
|
||||
styles.push_back(key);
|
||||
}
|
||||
|
||||
QSettings settings;
|
||||
QVariant vtheme = settings.value("theme");
|
||||
if (vtheme.isValid()) {
|
||||
QString theme = vtheme.toString();
|
||||
m_ui->themeInput->setCurrentText(theme);
|
||||
} else {
|
||||
m_ui->themeInput->setCurrentText("System");
|
||||
}
|
||||
|
||||
connect(m_ui->themeInput, qOverload<int>(&QComboBox::currentIndexChanged), this, &PageAppearance::onThemeChanged);
|
||||
}
|
||||
|
||||
PageAppearance::~PageAppearance()
|
||||
{
|
||||
}
|
||||
|
||||
void PageAppearance::onThemeChanged(int index)
|
||||
{
|
||||
if (index >= 0) {
|
||||
emit variableModified("theme", styles[index]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue