Редакция 70 | Редакция 72 | К новейшей редакции | Весь файл | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 70 | Редакция 71 | ||
---|---|---|---|
Строка 173... | Строка 173... | ||
173 | 173 | ||
174 | 174 | ||
175 | 175 | ||
176 | 176 | ||
177 | 177 | ||
178 | /////////////////model = new QSqlTableModel(this);
|
178 | model = new QSqlTableModel(this); // õðàíèëèùå îáúåêòîâ êëàññà |
179 | mymodel = new MyModel(this); |
179 | mymodel = new MyModel(this); |
180 | //modelForDescription = new QSqlTableModel(this);
|
180 | //modelForDescription = new QSqlTableModel(this);
|
181 | modelForDescription = new ModelForDescriptionTable(this); |
181 | modelForDescription = new ModelForDescriptionTable(this); |
182 | 182 | ||
183 | 183 | ||
Строка 186... | Строка 186... | ||
186 | modelForDescription->setTable(tr("DescriptionOfClasses")); |
186 | modelForDescription->setTable(tr("DescriptionOfClasses")); |
187 | modelForDescription->setEditStrategy(QSqlTableModel::OnFieldChange); |
187 | modelForDescription->setEditStrategy(QSqlTableModel::OnFieldChange); |
188 | 188 | ||
189 | /////model->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
189 | /////model->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
190 | 190 | ||
191 | /*
|
191 | |
192 | model->setEditStrategy(QSqlTableModel::OnFieldChange);
|
- | |
- | 192 | ||
193 | mymodel->setEditStrategy(QSqlTableModel::OnFieldChange);
|
193 | //mymodel->setEditStrategy(QSqlTableModel::OnFieldChange);
|
194 | */
|
194 | |
195 | 195 | ||
196 | 196 | ||
197 | //////////////////model->setSort(0, Qt::AscendingOrder);
|
197 | //////////////////model->setSort(0, Qt::AscendingOrder);
|
198 | mymodel->setSort(0, Qt::AscendingOrder); |
198 | mymodel->setSort(0, Qt::AscendingOrder); |
199 | modelForDescription->setSort(0, Qt::AscendingOrder); |
199 | modelForDescription->setSort(0, Qt::AscendingOrder); |
Строка 253... | Строка 253... | ||
253 | 253 | ||
254 | QItemSelection selection(topLeft, bottomRight); |
254 | QItemSelection selection(topLeft, bottomRight); |
255 | selectionModel->select(selection, QItemSelectionModel::Select); |
255 | selectionModel->select(selection, QItemSelectionModel::Select); |
256 | 256 | ||
257 | 257 | ||
258 | QString class_indx;
|
258 | QString class_indx, class_instance;
|
259 | QString str_fltr = tr("ClassIdentifer = "); |
259 | QString str_fltr = tr("ClassIdentifer = "); |
260 | class_indx = mymodel->data(mymodel->index(0,0)).toString(); |
260 | class_indx = mymodel->data(mymodel->index(0,0)).toString(); |
- | 261 | class_instance = mymodel->data(mymodel->index(0,3)).toString(); |
|
- | 262 | //class_instance.append(tr("_inctance"));
|
|
261 | str_fltr.append(class_indx); |
263 | str_fltr.append(class_indx); |
262 | 264 | ||
- | 265 | model->setTable(class_instance); |
|
- | 266 | //model->setTable(tr("memory"));
|
|
- | 267 | model->setEditStrategy(QSqlTableModel::OnFieldChange); |
|
- | 268 | model->select(); |
|
- | 269 | tableForInstance.setModel(model); |
|
- | 270 | tableForInstance.resizeColumnsToContents(); |
|
- | 271 | tableForInstance.show(); |
|
- | 272 | ||
263 | modelForDescription->setFilter(str_fltr); |
273 | modelForDescription->setFilter(str_fltr); |
264 | modelForDescription->select(); |
274 | modelForDescription->select(); |
265 | ui->tableView_2->resizeColumnsToContents(); |
275 | ui->tableView_2->resizeColumnsToContents(); |
266 | 276 | ||
267 | 277 | ||
Строка 307... | Строка 317... | ||
307 | break; |
317 | break; |
308 | }
|
318 | }
|
309 | }
|
319 | }
|
310 | 320 | ||
311 | 321 | ||
312 | 322 | /*
|
|
313 | void ClassEditor::addNewClass(){ |
323 | void ClassEditor::addNewClass(){
|
314 | 324 | ||
315 | int row = model->rowCount(); |
325 | int row = model->rowCount();
|
316 | 326 | ||
317 | model->insertRows(row, 1); |
327 | model->insertRows(row, 1);
|
Строка 336... | Строка 346... | ||
336 | model->submitAll(); |
346 | model->submitAll();
|
337 | mymodel->select(); |
347 | mymodel->select();
|
338 | 348 | ||
339 | 349 | ||
340 | }
|
350 | }
|
341 | 351 | */
|
|
342 | 352 | ||
343 | void ClassEditor::addNewClass_new(){ |
353 | void ClassEditor::addNewClass_new(){ |
344 | 354 | ||
345 | int row = mymodel->rowCount(); |
355 | int row = mymodel->rowCount(); |
346 | 356 | ||
Строка 435... | Строка 445... | ||
435 | int i, row, column; |
445 | int i, row, column; |
436 | i++; |
446 | i++; |
437 | row = index.row(); |
447 | row = index.row(); |
438 | column = index.column(); |
448 | column = index.column(); |
439 | currIndexOfClassesTable = index; |
449 | currIndexOfClassesTable = index; |
440 | QModelIndex index_tmp;
|
450 | QModelIndex index_tmp, index_instance;
|
441 | QString tmp_str, filter_str;
|
451 | QString tmp_str, filter_str, instance_str;
|
442 | index_tmp = ui->tableView->model()->index(row, 0); |
452 | index_tmp = ui->tableView->model()->index(row, 0); |
- | 453 | index_instance = ui->tableView->model()->index(row, 3); |
|
443 | tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
454 | tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
- | 455 | instance_str = ui->tableView->model()->data(index_instance).toString(); |
|
- | 456 | // instance_str.append(tr("_inctance"));
|
|
- | 457 | ||
- | 458 | model->setTable(instance_str); |
|
- | 459 | model->select(); |
|
- | 460 | tableForInstance.setWindowTitle(instance_str); |
|
- | 461 | // tableForInstance.setModel(model);
|
|
- | 462 | tableForInstance.resizeColumnsToContents(); |
|
- | 463 | ||
444 | currClassID = tmp_str; |
464 | currClassID = tmp_str; |
445 | // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
|
465 | // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
|
446 | filter_str = tr("ClassIdentifer = "); |
466 | filter_str = tr("ClassIdentifer = "); |
447 | filter_str.append(tmp_str); |
467 | filter_str.append(tmp_str); |
448 | modelForDescription->setFilter(filter_str); |
468 | modelForDescription->setFilter(filter_str); |