Редакция 71 | Редакция 73 | К новейшей редакции | Весь файл | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 71 | Редакция 72 | ||
---|---|---|---|
Строка 173... | Строка 173... | ||
173 | 173 | ||
174 | 174 | ||
175 | 175 | ||
176 | 176 | ||
177 | 177 | ||
178 | model = new QSqlTableModel(this); // õðàíèëèùå îáúåêòîâ êëàññà |
178 | model = new QSqlTableModel(); // õðàíèëèùå îáúåêòîâ êëàññà |
- | 179 | tableForInstance = new QTableView(); |
|
179 | mymodel = new MyModel(this); |
180 | mymodel = new MyModel(this); |
180 | //modelForDescription = new QSqlTableModel(this);
|
181 | //modelForDescription = new QSqlTableModel(this);
|
181 | modelForDescription = new ModelForDescriptionTable(this); |
182 | modelForDescription = new ModelForDescriptionTable(this); |
182 | 183 | ||
183 | 184 | ||
Строка 237... | Строка 238... | ||
237 | ui->tableView_2->hideColumn(5);
|
238 | ui->tableView_2->hideColumn(5);
|
238 | ui->tableView_2->hideColumn(2);
|
239 | ui->tableView_2->hideColumn(2);
|
239 | */
|
240 | */
|
240 | ui->tableView_2->setItemDelegateForColumn(3, &classTableDelegate); |
241 | ui->tableView_2->setItemDelegateForColumn(3, &classTableDelegate); |
241 | 242 | ||
242 | currIndexOfClassesTable = modelForDescription->index(0, 1); |
243 | currIndexOfClassesTable = mymodel->index(0, 1); |
243 | QModelIndex index_temp;
|
244 | QModelIndex index_temp;
|
244 | 245 | ||
245 | currClassID = mymodel->data(mymodel->index(0,0)).toString(); |
246 | currClassID = mymodel->data(mymodel->index(0,0)).toString(); |
246 | QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
247 | QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
247 | 248 | ||
Строка 262... | Строка 263... | ||
262 | //class_instance.append(tr("_inctance"));
|
263 | //class_instance.append(tr("_inctance"));
|
263 | str_fltr.append(class_indx); |
264 | str_fltr.append(class_indx); |
264 | 265 | ||
265 | model->setTable(class_instance); |
266 | model->setTable(class_instance); |
266 | //model->setTable(tr("memory"));
|
267 | //model->setTable(tr("memory"));
|
267 | model->setEditStrategy(QSqlTableModel::OnFieldChange); |
268 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
268 | model->select(); |
269 | model->select(); |
269 | tableForInstance.setModel(model); |
270 | tableForInstance->setModel(model); |
270 | tableForInstance.resizeColumnsToContents(); |
271 | tableForInstance->resizeColumnsToContents(); |
- | 272 | tableForInstance->setWindowTitle(class_instance); |
|
271 | tableForInstance.show(); |
273 | tableForInstance->show(); |
272 | 274 | ||
273 | modelForDescription->setFilter(str_fltr); |
275 | modelForDescription->setFilter(str_fltr); |
274 | modelForDescription->select(); |
276 | modelForDescription->select(); |
275 | ui->tableView_2->resizeColumnsToContents(); |
277 | ui->tableView_2->resizeColumnsToContents(); |
276 | 278 | ||
277 | 279 | ||
278 | 280 | ||
279 | //connect(ui->tableView, SIGNAL(clicked(const QModelIndex)), this, SLOT(on_tableView_clicked(const QModelIndex)));
|
281 | //connect(ui->tableView, SIGNAL(clicked(const QModelIndex)), this, SLOT(on_tableView_clicked(const QModelIndex)));
|
280 | connect(mymodel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_myModel_dataChanged(QModelIndex,QModelIndex))); |
282 | connect(mymodel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_myModel_dataChanged(QModelIndex,QModelIndex))); |
281 | connect(modelForDescription, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_modelForDescription_dataChanged(QModelIndex,QModelIndex))); |
283 | connect(modelForDescription, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_modelForDescription_dataChanged(QModelIndex,QModelIndex))); |
282 | connect(ui->newClassAction, SIGNAL(triggered(bool)), this, SLOT(on_pushButton_clicked(bool))); |
284 | //connect(ui->newClassAction, SIGNAL(triggered(bool)), this, SLOT(on_pushButton_clicked(bool)));
|
283 | connect(ui->action_ID, SIGNAL(triggered(bool)), this, SLOT(on_action_ID_triggered(bool))); |
285 | connect(ui->action_ID, SIGNAL(triggered(bool)), this, SLOT(on_action_ID_triggered(bool))); |
284 | connect(ui->action_showAlias, SIGNAL(triggered(bool)), this, SLOT(on_action_showAlias_triggered(bool))); // ïîêàçûâàòü ïñåâäîíèìû |
286 | connect(ui->action_showAlias, SIGNAL(triggered(bool)), this, SLOT(on_action_showAlias_triggered(bool))); // ïîêàçûâàòü ïñåâäîíèìû |
285 | connect(ui->action_showInstance, SIGNAL(triggered(bool)), this, SLOT(on_action_showInstance_triggered(bool))); // ïîêàçûâàòü õðàíèëèùà îáúåêòîâ |
287 | connect(ui->action_showInstance, SIGNAL(triggered(bool)), this, SLOT(on_action_showInstance_triggered(bool))); // ïîêàçûâàòü õðàíèëèùà îáúåêòîâ |
286 | connect(ui->action_removeSelectedFields, SIGNAL(triggered()), this, SLOT(on_pushButton_4_clicked())); // óäàëèòü âûäåëåííûå ïîëÿ |
288 | connect(ui->action_removeSelectedFields, SIGNAL(triggered()), this, SLOT(on_pushButton_4_clicked())); // óäàëèòü âûäåëåííûå ïîëÿ |
287 | connect(ui->action_removeAllFields, SIGNAL(triggered()), this, SLOT(on_pushButton_5_clicked())); // óäàëèòü âñå ïîëÿ |
289 | connect(ui->action_removeAllFields, SIGNAL(triggered()), this, SLOT(on_pushButton_5_clicked())); // óäàëèòü âñå ïîëÿ |
288 | connect(ui->action_removeSelectedClasses, SIGNAL(triggered()), this, SLOT(on_pushButton_2_clicked())); // óäàëèòü âûäåëåííûå êëàññû |
290 | connect(ui->action_removeSelectedClasses, SIGNAL(triggered()), this, SLOT(on_pushButton_2_clicked())); // óäàëèòü âûäåëåííûå êëàññû |
289 | connect(ui->action_removeAllClasses, SIGNAL(triggered()), this, SLOT(on_action_removeAllClasses())); // óäàëèòü âûäåëåííûå êëàññû |
291 | connect(ui->action_removeAllClasses, SIGNAL(triggered()), this, SLOT(on_action_removeAllClasses())); // óäàëèòü âûäåëåííûå êëàññû |
- | 292 | connect(ui->action_newClass, SIGNAL(triggered()), this, SLOT(on_pushButton_clicked())); // óäàëèòü âûäåëåííûå êëàññû |
|
290 | }
|
293 | }
|
291 | 294 | ||
292 | 295 | ||
293 | 296 | ||
294 | 297 | ||
Строка 300... | Строка 303... | ||
300 | 303 | ||
301 | 304 | ||
302 | ClassEditor::~ClassEditor() |
305 | ClassEditor::~ClassEditor() |
303 | {
|
306 | {
|
304 | delete ui; |
307 | delete ui; |
- | 308 | delete model; |
|
- | 309 | delete tableForInstance; |
|
305 | // delete field;
|
310 | // delete field;
|
306 | // delete settdialog;
|
311 | // delete settdialog;
|
307 | }
|
312 | }
|
308 | 313 | ||
309 | void ClassEditor::changeEvent(QEvent *e) |
314 | void ClassEditor::changeEvent(QEvent *e) |
Строка 411... | Строка 416... | ||
411 | // QSqlRecord rec = mymodel->record(1);
|
416 | // QSqlRecord rec = mymodel->record(1);
|
412 | //bool ok;
|
417 | //bool ok;
|
413 | //ok = rec.isEmpty();
|
418 | //ok = rec.isEmpty();
|
414 | //QString currientClassID;
|
419 | //QString currientClassID;
|
415 | //currientClassID = rec.value(1).toString();
|
420 | //currientClassID = rec.value(1).toString();
|
- | 421 | QString Inctance_str;
|
|
- | 422 | int currRow = ClassEditor::currIndexOfClassesTable.row(); // |
|
- | 423 | Inctance_str = mymodel->data(mymodel->index(currRow, 3)).toString(); |
|
- | 424 | ||
416 | int row = modelForDescription->rowCount(); |
425 | int row = modelForDescription->rowCount(); |
417 | modelForDescription->insertRows(row, 1); |
426 | modelForDescription->insertRows(row, 1); |
418 | modelForDescription->setData(modelForDescription->index(row, 5), QVariant(currClassID), Qt::EditRole); |
427 | modelForDescription->setData(modelForDescription->index(row, 5), QVariant(currClassID), Qt::EditRole); |
419 | modelForDescription->setData(modelForDescription->index(row, 4), QVariant(tr("NULL")), Qt::EditRole); |
428 | modelForDescription->setData(modelForDescription->index(row, 4), QVariant(tr("NULL")), Qt::EditRole); |
420 | 429 | ||
Строка 452... | Строка 461... | ||
452 | index_tmp = ui->tableView->model()->index(row, 0); |
461 | index_tmp = ui->tableView->model()->index(row, 0); |
453 | index_instance = ui->tableView->model()->index(row, 3); |
462 | index_instance = ui->tableView->model()->index(row, 3); |
454 | tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
463 | tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
455 | instance_str = ui->tableView->model()->data(index_instance).toString(); |
464 | instance_str = ui->tableView->model()->data(index_instance).toString(); |
456 | // instance_str.append(tr("_inctance"));
|
465 | // instance_str.append(tr("_inctance"));
|
- | 466 | /*
|
|
- | 467 | Inctance_model.clear();
|
|
- | 468 | Inctance_model.setTable(instance_str);
|
|
- | 469 | Inctance_model.select();
|
|
- | 470 | tableForInstance_new.setModel(&Inctance_model);
|
|
- | 471 | tableForInstance_new.show();
|
|
457 | 472 | */
|
|
- | 473 | // model->clear();
|
|
- | 474 | tableForInstance->close(); |
|
- | 475 | delete model; |
|
- | 476 | delete tableForInstance; |
|
- | 477 | model = new QSqlTableModel(); |
|
- | 478 | tableForInstance = new QTableView(); |
|
458 | model->setTable(instance_str); |
479 | model->setTable(instance_str); |
- | 480 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
|
- | 481 | tableForInstance->setModel(model); |
|
- | 482 | ||
459 | model->select(); |
483 | model->select(); |
460 | tableForInstance.setWindowTitle(instance_str); |
484 | tableForInstance->setWindowTitle(instance_str); |
- | 485 | tableForInstance->show(); |
|
- | 486 | ||
461 | // tableForInstance.setModel(model);
|
487 | // tableForInstance.setModel(model);
|
462 | tableForInstance.resizeColumnsToContents(); |
488 | tableForInstance->resizeColumnsToContents(); |
463 | 489 | ||
464 | currClassID = tmp_str; |
490 | currClassID = tmp_str; |
465 | // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
|
491 | // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
|
466 | filter_str = tr("ClassIdentifer = "); |
492 | filter_str = tr("ClassIdentifer = "); |
467 | filter_str.append(tmp_str); |
493 | filter_str.append(tmp_str); |