# HG changeset patch # User Matti Hamalainen # Date 1491229419 -10800 # Node ID 7fd15537b12debc1b5b7c671f0c5e163112896fe # Parent 9c6feafba7ce2f2cdd078fbdbf180ef086d4b5ff Commonize stylesheet code. diff -r 9c6feafba7ce -r 7fd15537b12d main.cpp --- 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();