changeset 31:9c6feafba7ce

Work on UI cosmetics and stylesheet stuff.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 03 Apr 2017 17:16:07 +0300
parents 9ca399a7229b
children 7fd15537b12d
files main.cpp mainwindow.ui
diffstat 2 files changed, 25 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/main.cpp	Mon Apr 03 16:33:11 2017 +0300
+++ b/main.cpp	Mon Apr 03 17:16:07 2017 +0300
@@ -131,22 +131,22 @@
     }
 
     QSqlQuery query;
-    query.exec(
+    query.exec(QStringLiteral(
         "CREATE TABLE people (id INTEGER PRIMARY KEY, "
         "first_name VARCHAR(128) NOT NULL, "
         "last_name VARCHAR(128) NOT NULL, "
         "extra_info VARCHAR(2048), "
         "added DATETIME NOT NULL, "
-        "updated DATETIME NOT NULL)");
+        "updated DATETIME NOT NULL)"));
 
     checkAndReportSQLError("CREATE TABLE people", query.lastError());
 
-    query.exec(
+    query.exec(QStringLiteral(
         "CREATE TABLE transactions ("
         "id INTEGER PRIMARY KEY, "
         "person INT NOT NULL, "
         "value REAL, "
-        "added DATETIME NOT NULL)");
+        "added DATETIME NOT NULL)"));
 
     checkAndReportSQLError("CREATE TABLE transactions", query.lastError());
 
@@ -171,9 +171,27 @@
 
     ui->edit_Amount->setValidator(new QDoubleValidator(0, 1000, 2, this));
 
-    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;");
+    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;");
 
     // Setup person list filtering and sorting
     peopleSortIndex = 1;
@@ -221,8 +239,6 @@
 
 SyntilistaMainWindow::~SyntilistaMainWindow()
 {
-    printf("QUITTAUS\n");
-
     saveSettings();
 
     delete ui;
--- a/mainwindow.ui	Mon Apr 03 16:33:11 2017 +0300
+++ b/mainwindow.ui	Mon Apr 03 17:16:07 2017 +0300
@@ -10,11 +10,6 @@
     <height>646</height>
    </rect>
   </property>
-  <property name="font">
-   <font>
-    <pointsize>12</pointsize>
-   </font>
-  </property>
   <property name="windowTitle">
    <string>Kampus Cafe Syntilista</string>
   </property>
@@ -123,11 +118,6 @@
          </property>
          <item>
           <widget class="QLabel" name="label_PersonName">
-           <property name="font">
-            <font>
-             <pointsize>16</pointsize>
-            </font>
-           </property>
            <property name="text">
             <string>Henkilön nimi</string>
            </property>
@@ -154,11 +144,6 @@
            </item>
            <item>
             <widget class="QLabel" name="label_BalanceValue">
-             <property name="font">
-              <font>
-               <pointsize>16</pointsize>
-              </font>
-             </property>
              <property name="text">
               <string>12345</string>
              </property>
@@ -169,11 +154,6 @@
            </item>
            <item>
             <widget class="QLabel" name="label_EUR">
-             <property name="font">
-              <font>
-               <pointsize>14</pointsize>
-              </font>
-             </property>
              <property name="text">
               <string>EUR</string>
              </property>
@@ -196,11 +176,6 @@
          </item>
          <item>
           <widget class="QLineEdit" name="edit_Amount">
-           <property name="font">
-            <font>
-             <pointsize>14</pointsize>
-            </font>
-           </property>
            <property name="text">
             <string/>
            </property>
@@ -213,11 +188,6 @@
           <layout class="QHBoxLayout" name="horizontalLayout_5">
            <item>
             <widget class="QPushButton" name="button_AddDebt">
-             <property name="font">
-              <font>
-               <pointsize>14</pointsize>
-              </font>
-             </property>
              <property name="text">
               <string>Lisää velkaa</string>
              </property>
@@ -227,11 +197,6 @@
             <widget class="QPushButton" name="button_PayDebt">
              <property name="palette">
              </property>
-             <property name="font">
-              <font>
-               <pointsize>14</pointsize>
-              </font>
-             </property>
              <property name="text">
               <string>Maksa velkaa</string>
              </property>
@@ -302,11 +267,6 @@
         </property>
         <item>
          <widget class="QPushButton" name="button_Quit">
-          <property name="font">
-           <font>
-            <pointsize>14</pointsize>
-           </font>
-          </property>
           <property name="text">
            <string>Poistu ohjelmasta</string>
           </property>