Use common colors and style sheets for all windows and dialogs
[scorecard] / src / score-dialog.cpp
index 443bfd2..4b42593 100644 (file)
@@ -10,6 +10,7 @@
 #include <QInputContext>
 
 #include "score-dialog.h"
+#include "score-common.h"
 
 SelectDialog::SelectDialog(QWidget *parent) : QDialog(parent)
 {
@@ -152,6 +153,8 @@ void ScoreDialog::createTable(QWidget *parent)
   table->verticalHeader()->setResizeMode(QHeaderView::Stretch);
   table->horizontalHeader()->hide();
 
+  table->setStyleSheet(ScoreColor::styleSheet());
+
   QStringList headers;
   headers << "" << "Par" << "HCP" << "Score" << "" << "Par" << "HCP" << "Score";
   table->setVerticalHeaderLabels(headers);
@@ -175,8 +178,6 @@ void ScoreDialog::createButton(QWidget *parent)
 void ScoreDialog::init(Course *course, Score *score)
 {
   QTableWidgetItem *par, *hcp, *scoreItem, *holeNum;
-  QColor fgColor(Qt::white);
-  QColor bgColor(Qt::darkGray);
 
   for (int i = 0; i < 18; i++) {
     par = new QTableWidgetItem(course->getPar(i));
@@ -187,8 +188,7 @@ void ScoreDialog::init(Course *course, Score *score)
       scoreItem = new QTableWidgetItem("");
     holeNum = new QTableWidgetItem(QString::number(i+1));
 
-    holeNum->setTextColor(fgColor);
-    holeNum->setBackgroundColor(bgColor);
+    holeNum->setBackgroundColor(ScoreColor::holeBg());
 
     par->setTextAlignment(Qt::AlignCenter);
     hcp->setTextAlignment(Qt::AlignCenter);