summaryrefslogtreecommitdiff
path: root/src/settingsdialog.cpp
diff options
context:
space:
mode:
authorLostDragonist <lost.dragonist@gmail.com>2018-11-09 17:42:15 -0600
committerLostDragonist <lost.dragonist@gmail.com>2018-11-09 18:14:01 -0600
commit545b7b4eb7f629ccbbe03d7c20c305f1225b5416 (patch)
tree8a3a4ff40c6819f67a83ee857ed4da781483e7e4 /src/settingsdialog.cpp
parent71830a65d49587d012b00e0cea39e270011e2ce7 (diff)
Fix button colors in the settings dialog with the default theme
Diffstat (limited to 'src/settingsdialog.cpp')
-rw-r--r--src/settingsdialog.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp
index 7f484830..8a983896 100644
--- a/src/settingsdialog.cpp
+++ b/src/settingsdialog.cpp
@@ -59,6 +59,16 @@ SettingsDialog::~SettingsDialog()
delete ui;
}
+QString SettingsDialog::getColoredButtonStyleSheet() const
+{
+ return QString("QPushButton {"
+ "background-color: %1;"
+ "color: %2;"
+ "border: 1px solid;"
+ "padding: 3px;"
+ "}");
+}
+
void SettingsDialog::accept()
{
QString newModPath = ui->modDirEdit->text();
@@ -184,8 +194,7 @@ void SettingsDialog::on_containsBtn_clicked()
if (result.isValid()) {
m_ContainsColor = result;
- QString COLOR_STYLE("QPushButton { background-color : %1; color : %2; }");
- ui->containsBtn->setStyleSheet(COLOR_STYLE.arg(
+ ui->containsBtn->setStyleSheet(getColoredButtonStyleSheet().arg(
result.name()).arg(Settings::getIdealTextColor(
result).name()));
@@ -203,8 +212,7 @@ void SettingsDialog::on_containedBtn_clicked()
if (result.isValid()) {
m_ContainedColor = result;
- QString COLOR_STYLE("QPushButton { background-color : %1; color : %2; }");
- ui->containedBtn->setStyleSheet(COLOR_STYLE.arg(
+ ui->containedBtn->setStyleSheet(getColoredButtonStyleSheet().arg(
result.name()).arg(Settings::getIdealTextColor(
result).name()));
@@ -222,8 +230,7 @@ void SettingsDialog::on_overwrittenBtn_clicked()
if (result.isValid()) {
m_OverwrittenColor = result;
- QString COLOR_STYLE("QPushButton { background-color : %1; color : %2; }");
- ui->overwrittenBtn->setStyleSheet(COLOR_STYLE.arg(
+ ui->overwrittenBtn->setStyleSheet(getColoredButtonStyleSheet().arg(
result.name()).arg(Settings::getIdealTextColor(
result).name()));
@@ -241,8 +248,7 @@ void SettingsDialog::on_overwritingBtn_clicked()
if (result.isValid()) {
m_OverwritingColor = result;
- QString COLOR_STYLE("QPushButton { background-color : %1; color : %2; }");
- ui->overwritingBtn->setStyleSheet(COLOR_STYLE.arg(
+ ui->overwritingBtn->setStyleSheet(getColoredButtonStyleSheet().arg(
result.name()).arg(Settings::getIdealTextColor(
result).name()));
@@ -261,21 +267,19 @@ void SettingsDialog::on_resetColorsBtn_clicked()
m_ContainsColor = QColor(0, 0, 255, 64);
m_ContainedColor = QColor(0, 0, 255, 64);
- QString COLOR_STYLE("QPushButton { background-color : %1; color : %2; }");
-
- ui->overwritingBtn->setStyleSheet(COLOR_STYLE.arg(
+ ui->overwritingBtn->setStyleSheet(getColoredButtonStyleSheet().arg(
QColor(255, 0, 0, 64).name()).arg(Settings::getIdealTextColor(
QColor(255, 0, 0, 64)).name()));
- ui->overwrittenBtn->setStyleSheet(COLOR_STYLE.arg(
+ ui->overwrittenBtn->setStyleSheet(getColoredButtonStyleSheet().arg(
QColor(0, 255, 0, 64).name()).arg(Settings::getIdealTextColor(
QColor(0, 255, 0, 64)).name()));
- ui->containsBtn->setStyleSheet(COLOR_STYLE.arg(
+ ui->containsBtn->setStyleSheet(getColoredButtonStyleSheet().arg(
QColor(0, 0, 255, 64).name()).arg(Settings::getIdealTextColor(
QColor(0, 0, 255, 64)).name()));
- ui->containedBtn->setStyleSheet(COLOR_STYLE.arg(
+ ui->containedBtn->setStyleSheet(getColoredButtonStyleSheet().arg(
QColor(0, 0, 255, 64).name()).arg(Settings::getIdealTextColor(
QColor(0, 0, 255, 64)).name()));