From ea6f15b08ce9d4218c3fdda33a11c4b1869f6a50 Mon Sep 17 00:00:00 2001 From: q5sys Date: Mon, 31 Jul 2017 10:46:20 -0400 Subject: bring bracket sanity to a wasteland of if statements --- .../src/lthemeengine/paletteeditdialog.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp') diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp index 8a8e86d0..9cce5a6e 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp @@ -37,15 +37,12 @@ QPalette PaletteEditDialog::selectedPalette() const{ void PaletteEditDialog::setPalette(const QPalette &palette){ for(int i = 0; i < QPalette::NColorRoles; i++){ - if(!m_ui->tableWidget->item(i,0)) - m_ui->tableWidget->setItem(i, 0, new QTableWidgetItem()); - if(!m_ui->tableWidget->item(i,1)) - m_ui->tableWidget->setItem(i, 1, new QTableWidgetItem()); - if(!m_ui->tableWidget->item(i,2)) - m_ui->tableWidget->setItem(i, 2, new QTableWidgetItem()); - m_ui->tableWidget->item(i,0)->setBackgroundColor(palette.color(QPalette::Active, QPalette::ColorRole(i))); - m_ui->tableWidget->item(i,1)->setBackgroundColor(palette.color(QPalette::Inactive, QPalette::ColorRole(i))); - m_ui->tableWidget->item(i,2)->setBackgroundColor(palette.color(QPalette::Disabled, QPalette::ColorRole(i))); + if(!m_ui->tableWidget->item(i,0)){ m_ui->tableWidget->setItem(i, 0, new QTableWidgetItem()); } + if(!m_ui->tableWidget->item(i,1)){ m_ui->tableWidget->setItem(i, 1, new QTableWidgetItem()); } + if(!m_ui->tableWidget->item(i,2)){ m_ui->tableWidget->setItem(i, 2, new QTableWidgetItem()); } + m_ui->tableWidget->item(i,0)->setBackgroundColor(palette.color(QPalette::Active, QPalette::ColorRole(i))); + m_ui->tableWidget->item(i,1)->setBackgroundColor(palette.color(QPalette::Inactive, QPalette::ColorRole(i))); + m_ui->tableWidget->item(i,2)->setBackgroundColor(palette.color(QPalette::Disabled, QPalette::ColorRole(i))); } QStringList labels; labels << tr("Window text") << tr("Button background") << tr("Bright") << tr("Less bright") << tr("Dark") << tr("Less dark") << tr("Normal text") << tr("Bright text") << tr("Button text") << tr("Normal background") << tr("Window") << tr("Shadow") << tr("Highlight") << tr("Highlighted text") << tr("Link") << tr("Visited link") << tr("Alternate background") << tr("Default") << tr("Tooltip background") << tr("Tooltip text"); -- cgit