comparison src/main.cpp @ 123:e76d85ea87ac

Rename SQL_MAX_* defines to SQL_LEN_* for being more descriptive .. maybe.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 06 Jul 2017 15:47:18 +0300
parents f0db8267911b
children a063cb8a171b
comparison
equal deleted inserted replaced
122:f0db8267911b 123:e76d85ea87ac
224 "first_name VARCHAR(%1) NOT NULL, " 224 "first_name VARCHAR(%1) NOT NULL, "
225 "last_name VARCHAR(%2) NOT NULL, " 225 "last_name VARCHAR(%2) NOT NULL, "
226 "extra_info VARCHAR(%3), " 226 "extra_info VARCHAR(%3), "
227 "added DATETIME NOT NULL, " 227 "added DATETIME NOT NULL, "
228 "updated DATETIME NOT NULL)"). 228 "updated DATETIME NOT NULL)").
229 arg(SQL_MAX_FIRST_NAME). 229 arg(SQL_LEN_FIRST_NAME).
230 arg(SQL_MAX_LAST_NAME). 230 arg(SQL_LEN_LAST_NAME).
231 arg(SQL_MAX_EXTRA_INFO)); 231 arg(SQL_LEN_EXTRA_INFO));
232 232
233 slCheckAndReportSQLError("CREATE TABLE people", query.lastError()); 233 slCheckAndReportSQLError("CREATE TABLE people", query.lastError());
234 } 234 }
235 235
236 if (!db.tables().contains("transactions")) 236 if (!db.tables().contains("transactions"))
1097 ui->tableview_Transactions->setModel(model_Transactions); 1097 ui->tableview_Transactions->setModel(model_Transactions);
1098 ui->tableview_Transactions->setItemDelegate(new QSqlRelationalDelegate(ui->tableview_Transactions)); 1098 ui->tableview_Transactions->setItemDelegate(new QSqlRelationalDelegate(ui->tableview_Transactions));
1099 ui->tableview_Transactions->verticalHeader()->setVisible(false); 1099 ui->tableview_Transactions->verticalHeader()->setVisible(false);
1100 ui->tableview_Transactions->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); 1100 ui->tableview_Transactions->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
1101 1101
1102 ui->edit_FirstName->setMaxLength(SQL_MAX_FIRST_NAME); 1102 ui->edit_FirstName->setMaxLength(SQL_LEN_FIRST_NAME);
1103 ui->edit_LastName->setMaxLength(SQL_MAX_LAST_NAME); 1103 ui->edit_LastName->setMaxLength(SQL_LEN_LAST_NAME);
1104 1104
1105 connect( 1105 connect(
1106 ui->textedit_ExtraInfo, 1106 ui->textedit_ExtraInfo,
1107 SIGNAL(textChanged()), 1107 SIGNAL(textChanged()),
1108 this, 1108 this,
1128 bool EditPerson::validateForm() 1128 bool EditPerson::validateForm()
1129 { 1129 {
1130 selPerson.firstName = slCleanupStr(ui->edit_FirstName->text()); 1130 selPerson.firstName = slCleanupStr(ui->edit_FirstName->text());
1131 selPerson.lastName = slCleanupStr(ui->edit_LastName->text()); 1131 selPerson.lastName = slCleanupStr(ui->edit_LastName->text());
1132 selPerson.extraInfo = ui->textedit_ExtraInfo->document()->toPlainText(); 1132 selPerson.extraInfo = ui->textedit_ExtraInfo->document()->toPlainText();
1133 bool extraInfoValid = selPerson.extraInfo.length() < SQL_MAX_EXTRA_INFO; 1133 bool extraInfoValid = selPerson.extraInfo.length() < SQL_LEN_EXTRA_INFO;
1134 1134
1135 ui->textedit_ExtraInfo->setStyleSheet(!extraInfoValid ? "background-color: red;" : NULL); 1135 ui->textedit_ExtraInfo->setStyleSheet(!extraInfoValid ? "background-color: red;" : NULL);
1136 ui->edit_FirstName->setStyleSheet(selPerson.firstName == "" ? "background-color: red;" : NULL); 1136 ui->edit_FirstName->setStyleSheet(selPerson.firstName == "" ? "background-color: red;" : NULL);
1137 ui->edit_LastName->setStyleSheet(selPerson.lastName == "" ? "background-color: red;" : NULL); 1137 ui->edit_LastName->setStyleSheet(selPerson.lastName == "" ? "background-color: red;" : NULL);
1138 1138