git-svn-id: svn://db.shs.com.ru/libs@26 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2015-06-21 13:54:03 +00:00
parent 22fd105876
commit bd18963bf1
2 changed files with 16 additions and 15 deletions

View File

@@ -601,7 +601,8 @@ void SQLTableWidget::updateTable(bool save_selection) {
cquery = custom_query;
//qDebug() << cquery;
model->setQuery(cquery, QSqlDatabase::database(connection_name));
//qDebug() << model->lastError();
if (model->lastError().isValid())
qDebug() << model->lastError();
if (first_update) {
ui->view->resizeColumnsToContents();
for (int i = 0; i < ui->view->horizontalHeader()->count(); ++i)
@@ -618,7 +619,7 @@ void SQLTableWidget::updateTable(bool save_selection) {
foreach (const QModelIndex & i, sl)
sm->select(i, QItemSelectionModel::Select | QItemSelectionModel::Rows);
sm->setCurrentIndex(csi, QItemSelectionModel::Select);
ui->view->setFocus();
//ui->view->setFocus();
}
if (custom_query.isEmpty()) {
for (int i = 0; i < model->columnCount(); ++i) {

View File

@@ -74,30 +74,30 @@ void SessionManager::load(bool onlyMainwindow) {
}
if (onlyMainwindow) return;
for (int i = 0; i < checks.size(); ++i)
checks[i].second->setChecked(sr.getValue(checks[i].first, true));
checks[i].second->setChecked(sr.getValue(checks[i].first, checks[i].second->isChecked()));
for (int i = 0; i < lines.size(); ++i)
lines[i].second->setText(sr.getValue(lines[i].first, QString()));
lines[i].second->setText(sr.getValue(lines[i].first, lines[i].second->text()));
for (int i = 0; i < combos.size(); ++i)
combos[i].second->setCurrentIndex(sr.getValue(combos[i].first, 0));
combos[i].second->setCurrentIndex(sr.getValue(combos[i].first, combos[i].second->currentIndex()));
for (int i = 0; i < dspins.size(); ++i)
dspins[i].second->setValue(sr.getValue(dspins[i].first, 0.));
dspins[i].second->setValue(sr.getValue(dspins[i].first, dspins[i].second->value()));
for (int i = 0; i < spins.size(); ++i)
spins[i].second->setValue(sr.getValue(spins[i].first, 0));
spins[i].second->setValue(sr.getValue(spins[i].first, spins[i].second->value()));
for (int i = 0; i < tabs.size(); ++i)
tabs[i].second->setCurrentIndex(sr.getValue(tabs[i].first, 0));
tabs[i].second->setCurrentIndex(sr.getValue(tabs[i].first, tabs[i].second->currentIndex()));
for (int i = 0; i < actions.size(); ++i)
actions[i].second->setChecked(sr.getValue(actions[i].first, true));
actions[i].second->setChecked(sr.getValue(actions[i].first, actions[i].second->isChecked()));
for (int i = 0; i < stringlists.size(); ++i)
*stringlists[i].second = sr.getValue(stringlists[i].first, QStringList());
*stringlists[i].second = sr.getValue(stringlists[i].first, *stringlists[i].second);
for (int i = 0; i < strings.size(); ++i)
*strings[i].second = sr.getValue(strings[i].first, QString()).stringValue();
*strings[i].second = sr.getValue(strings[i].first, *strings[i].second).stringValue();
for (int i = 0; i < colors.size(); ++i)
*colors[i].second = sr.getValue(colors[i].first, QString());
*colors[i].second = sr.getValue(colors[i].first, *colors[i].second);
for (int i = 0; i < bools.size(); ++i)
*bools[i].second = sr.getValue(bools[i].first, true);
*bools[i].second = sr.getValue(bools[i].first, *bools[i].second);
for (int i = 0; i < ints.size(); ++i)
*ints[i].second = sr.getValue(ints[i].first, 0);
*ints[i].second = sr.getValue(ints[i].first, *ints[i].second);
for (int i = 0; i < floats.size(); ++i)
*floats[i].second = sr.getValue(floats[i].first, 0);
*floats[i].second = sr.getValue(floats[i].first, *floats[i].second);
emit loading(sr);
}