Хранилища Subversion OpenInventory

Сравнить редакции

Не учитывать пробелы Редакция 73 → Редакция 74

/trunk/ClassEditor/classeditor.cpp
587,12 → 587,51
 
qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå
 
 
QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà
Inctance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString();
for (int m =0; m < selectedRows.size(); ++m){
 
modelForDescription->removeRow(selectedRows.at(m));
 
QString query_str;
QString field_name_str; // èìÿ óäàëÿåìîãî ïîëÿ
QSqlQuery q;
 
query_str.clear();
 
 
field_name_str = modelForDescription->data(modelForDescription->index(selectedRows.at(m), 1)).toString();
 
query_str.append(tr("ALTER TABLE "));
query_str.append(Inctance_str);
query_str.append(tr(" DROP COLUMN `"));
query_str.append(field_name_str);
query_str.append(tr("`"));
q.prepare(query_str);
bool ok = q.exec();
if (!ok) {
QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå.
this, // Ðîäèòåëüñêèé âèäæåò.
QObject::tr("Database Error"), // Çàãîëîâîê.
q.lastError().text()); // Òåêñò ñîîáùåíèÿ.
 
return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé
 
}
 
 
 
modelForDescription->removeRow(selectedRows.at(m));
 
}
 
delete model;
delete tableForInstance;
model = new QSqlTableModel();
tableForInstance = new QTableView();
model->setTable(Inctance_str);
model->setEditStrategy(QSqlTableModel::OnManualSubmit);
tableForInstance->setModel(model);
tableForInstance->setWindowTitle(Inctance_str);
tableForInstance->show();
//i = selectedRows.size();
 
//if (i > 0) model_index = indexes.at(0);