changeset 32:7fd15537b12d

Commonize stylesheet code.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 03 Apr 2017 17:23:39 +0300
parents 9c6feafba7ce
children 5b15c0ca5560
files main.cpp
diffstat 1 files changed, 26 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/main.cpp	Mon Apr 03 17:16:07 2017 +0300
+++ b/main.cpp	Mon Apr 03 17:23:39 2017 +0300
@@ -110,6 +110,29 @@
 }
 
 
+void setCommonStyleSheet(QWidget *widget)
+{
+    widget->setStyleSheet(
+        QStringLiteral(
+        "* { font-size: %1pt; }"
+        "QPushButton { font-size: %2pt; padding: 0.25em; }"
+        "#button_AddDebt { font-size: %3pt; background-color: #900; color: black; }"
+        "#button_PayDebt { font-size: %3pt; background-color: #090; color: black; }"
+        "#button_PayFullDebt { background-color: #060; color: black; }"
+        "#label_PersonName { font-size: %5pt; font-weight: bold;  }"
+        "#label_BalanceValue { font-size: %4pt; font-weight: bold; }"
+        "#label_EUR { font-size: %4pt; font-weight: bold; }"
+        "#edit_Amount { font-size: %4pt; margin: 0.5em; padding: 0.5em; }"
+        ).
+        arg(14).
+        arg(16).
+        arg(20).
+        arg(16).
+        arg(22)
+        );
+}
+
+
 int main(int argc, char *argv[])
 {
     QApplication sapp(argc, argv);
@@ -170,28 +193,7 @@
     readSettings();
 
     ui->edit_Amount->setValidator(new QDoubleValidator(0, 1000, 2, this));
-
-    this->setStyleSheet(
-        QStringLiteral(
-        "* { font-size: %1pt; }"
-        "QPushButton { font-size: %2pt; padding: 0.25em; }"
-        "#button_AddDebt { font-size: %3pt; background-color: #900; color: black; }"
-        "#button_PayDebt { font-size: %3pt; background-color: #090; color: black; }"
-        "#button_PayFullDebt { background-color: #060; color: black; }"
-        "#label_PersonName { font-size: %4pt; }"
-        "#label_BalanceValue { font-size: %4pt; }"
-        "#label_EUR { font-size: %4pt; }"
-        "#edit_Amount { font-size: %4pt; }"
-        ).
-        arg(14).
-        arg(16).
-        arg(20).
-        arg(16)
-        );
-
-//    ui->button_AddDebt->setStyleSheet("background-color: #900; color: black;");
-//    ui->button_PayDebt->setStyleSheet("background-color: #090; color: black;");
-//    ui->button_PayFullDebt->setStyleSheet("background-color: #060; color: black;");
+    setCommonStyleSheet(this);
 
     // Setup person list filtering and sorting
     peopleSortIndex = 1;
@@ -654,6 +656,8 @@
 {
     ui->setupUi(this);
 
+    setCommonStyleSheet(this);
+
     setModal(true);
     setAttribute(Qt::WA_DeleteOnClose);
     show();