Редакция 81 | Редакция 83 | К новейшей редакции | Весь файл | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 81 | Редакция 82 | ||
---|---|---|---|
Строка 176... | Строка 176... | ||
176 | 176 | ||
177 | 177 | ||
178 | model = new QSqlTableModel(); // õðàíèëèùå îáúåêòîâ êëàññà |
178 | model = new QSqlTableModel(); // õðàíèëèùå îáúåêòîâ êëàññà |
179 | tableForInstance = new QTableView(); |
179 | tableForInstance = new QTableView(); |
180 | mymodel = new MyModel(this); |
180 | mymodel = new MyModel(this); |
- | 181 | modelForPointers = new ModelForPointers(this); // // ìîäåëü äëÿ òàáëèöû ñ óêàçàòåëÿìè |
|
- | 182 | ||
181 | //modelForDescription = new QSqlTableModel(this);
|
183 | //modelForDescription = new QSqlTableModel(this);
|
182 | modelForDescription = new ModelForDescriptionTable(this); |
184 | modelForDescription = new ModelForDescriptionTable(this); |
183 | 185 | ||
184 | 186 | ||
185 | /////////////////model->setTable(tr("ListOfClasses"));
|
187 | /////////////////model->setTable(tr("ListOfClasses"));
|
Строка 187... | Строка 189... | ||
187 | modelForDescription->setTable(tr("DescriptionOfClasses")); |
189 | modelForDescription->setTable(tr("DescriptionOfClasses")); |
188 | modelForDescription->setEditStrategy(QSqlTableModel::OnFieldChange); |
190 | modelForDescription->setEditStrategy(QSqlTableModel::OnFieldChange); |
189 | 191 | ||
190 | /////model->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
192 | /////model->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
191 | 193 | ||
- | 194 | modelForPointers->setEditStrategy(QSqlTableModel::OnManualSubmit); |
|
- | 195 | modelForPointers->setTable(tr("DescriptionOfClasses")); |
|
- | 196 | ||
- | 197 | ||
192 | 198 | ||
193 | 199 | ||
194 | //mymodel->setEditStrategy(QSqlTableModel::OnFieldChange);
|
200 | //mymodel->setEditStrategy(QSqlTableModel::OnFieldChange);
|
195 | 201 | ||
196 | 202 | ||
197 | 203 | ||
198 | //////////////////model->setSort(0, Qt::AscendingOrder);
|
204 | //////////////////model->setSort(0, Qt::AscendingOrder);
|
199 | mymodel->setSort(0, Qt::AscendingOrder); |
205 | mymodel->setSort(0, Qt::AscendingOrder); |
200 | modelForDescription->setSort(0, Qt::AscendingOrder); |
206 | modelForDescription->setSort(0, Qt::AscendingOrder); |
201 | - | ||
- | 207 | modelForPointers->setSort(0, Qt::AscendingOrder); |
|
202 | 208 | ||
203 | // model->setFilter(tr("Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = '7' and Èíâåíòàðíûé_íîìåð = 'i09090909'"));
|
209 | // model->setFilter(tr("Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = '7' and Èíâåíòàðíûé_íîìåð = 'i09090909'"));
|
204 | ////////////////////model->select();
|
210 | ////////////////////model->select();
|
205 | mymodel->select(); |
211 | mymodel->select(); |
- | 212 | // modelForPointers->select();
|
|
206 | 213 | ||
207 | 214 | ||
208 | 215 | ||
209 | 216 | ||
210 | /////////////////////////model->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà"));
|
217 | /////////////////////////model->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà"));
|
Строка 214... | Строка 221... | ||
214 | 221 | ||
215 | ////////////////////////model->setHeaderData(2, Qt::Horizontal, tr("Ïñåâäîíèì êëàññà"));
|
222 | ////////////////////////model->setHeaderData(2, Qt::Horizontal, tr("Ïñåâäîíèì êëàññà"));
|
216 | mymodel->setHeaderData(2, Qt::Horizontal, tr("Ïñåâäîíèì êëàññà")); |
223 | mymodel->setHeaderData(2, Qt::Horizontal, tr("Ïñåâäîíèì êëàññà")); |
217 | mymodel->setHeaderData(4, Qt::Horizontal, tr("Êîìåíòàðèé")); |
224 | mymodel->setHeaderData(4, Qt::Horizontal, tr("Êîìåíòàðèé")); |
218 | 225 | ||
- | 226 | //ui->tableView_3->setModel(modelForPointers);
|
|
219 | 227 | ||
220 | //ui->tableView->setModel(model);
|
228 | //ui->tableView->setModel(model);
|
221 | ui->tableView->setModel(mymodel); |
229 | ui->tableView->setModel(mymodel); |
222 | //tableForDescription = new QTableView();
|
230 | //tableForDescription = new QTableView();
|
223 | ui->tableView_2->setModel(modelForDescription); |
231 | ui->tableView_2->setModel(modelForDescription); |
Строка 279... | Строка 287... | ||
279 | 287 | ||
280 | modelForDescription->setFilter(str_fltr); |
288 | modelForDescription->setFilter(str_fltr); |
281 | modelForDescription->select(); |
289 | modelForDescription->select(); |
282 | ui->tableView_2->resizeColumnsToContents(); |
290 | ui->tableView_2->resizeColumnsToContents(); |
283 | 291 | ||
284 | - | ||
- | 292 | // str_fltr.clear();
|
|
- | 293 | // str_fltr.append( tr(" FieldType = pointer "));
|
|
- | 294 | modelForPointers->setFilter(tr(" FieldType = \"pointer\" ")); |
|
- | 295 | modelForPointers->select(); |
|
- | 296 | ui->tableView_3->setModel(modelForPointers); |
|
285 | 297 | ||
286 | //connect(ui->tableView, SIGNAL(clicked(const QModelIndex)), this, SLOT(on_tableView_clicked(const QModelIndex)));
|
298 | //connect(ui->tableView, SIGNAL(clicked(const QModelIndex)), this, SLOT(on_tableView_clicked(const QModelIndex)));
|
287 | connect(mymodel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_myModel_dataChanged(QModelIndex,QModelIndex))); |
299 | connect(mymodel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_myModel_dataChanged(QModelIndex,QModelIndex))); |
288 | connect(modelForDescription, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_modelForDescription_dataChanged(QModelIndex,QModelIndex))); |
300 | connect(modelForDescription, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_modelForDescription_dataChanged(QModelIndex,QModelIndex))); |
289 | //connect(ui->newClassAction, SIGNAL(triggered(bool)), this, SLOT(on_pushButton_clicked(bool)));
|
301 | //connect(ui->newClassAction, SIGNAL(triggered(bool)), this, SLOT(on_pushButton_clicked(bool)));
|
Строка 430... | Строка 442... | ||
430 | QString db_error;
|
442 | QString db_error;
|
431 | QSqlQuery q;
|
443 | QSqlQuery q;
|
432 | int currRow = ClassEditor::currIndexOfClassesTable.row(); // |
444 | int currRow = ClassEditor::currIndexOfClassesTable.row(); // |
433 | Inctance_str = mymodel->data(mymodel->index(currRow, 3)).toString(); |
445 | Inctance_str = mymodel->data(mymodel->index(currRow, 3)).toString(); |
434 | query_str.append( Inctance_str); |
446 | query_str.append( Inctance_str); |
435 | query_str.append(tr(" ADD COLUMN `New field` CHAR(10)")); |
447 | query_str.append(tr(" ADD COLUMN `New field` CHAR(30)")); |
436 | bool ok = q.prepare(query_str); |
448 | bool ok = q.prepare(query_str); |
437 | 449 | ||
438 | ok = q.exec(); |
450 | ok = q.exec(); |
439 | if (!ok) { |
451 | if (!ok) { |
440 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
452 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |