Редакция 61 | Редакция 63 | К новейшей редакции | Весь файл | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 61 | Редакция 62 | ||
---|---|---|---|
Строка 228... | Строка 228... | ||
228 | ui->tableView->resizeColumnsToContents(); |
228 | ui->tableView->resizeColumnsToContents(); |
229 | ui->tableView->hideColumn(0); |
229 | ui->tableView->hideColumn(0); |
230 | ui->tableView->hideColumn(3); |
230 | ui->tableView->hideColumn(3); |
231 | ui->tableView->hideColumn(2); |
231 | ui->tableView->hideColumn(2); |
232 | 232 | ||
- | 233 | ui->tableView_2->hideColumn(0); |
|
- | 234 | ui->tableView_2->hideColumn(5); |
|
- | 235 | ui->tableView_2->hideColumn(2); |
|
- | 236 | ||
- | 237 | currIndexOfClassesTable = modelForDescription->index(0, 1); |
|
- | 238 | QModelIndex index_temp;
|
|
- | 239 | ||
- | 240 | currClassID = mymodel->data(mymodel->index(0,0)).toString(); |
|
- | 241 | QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
|
- | 242 | ||
- | 243 | QModelIndex topLeft;
|
|
- | 244 | QModelIndex bottomRight;
|
|
- | 245 | ||
- | 246 | topLeft = mymodel->index(0, 0, QModelIndex()); |
|
- | 247 | bottomRight = mymodel->index(0, 1, QModelIndex()); |
|
- | 248 | ||
- | 249 | QItemSelection selection(topLeft, bottomRight); |
|
- | 250 | selectionModel->select(selection, QItemSelectionModel::Select); |
|
- | 251 | ||
- | 252 | ||
233 | 253 | ||
234 | //connect(ui->tableView, SIGNAL(clicked(const QModelIndex)), this, SLOT(on_tableView_clicked(const QModelIndex)));
|
254 | //connect(ui->tableView, SIGNAL(clicked(const QModelIndex)), this, SLOT(on_tableView_clicked(const QModelIndex)));
|
- | 255 | connect(mymodel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_myModel_dataChanged(QModelIndex,QModelIndex))); |
|
- | 256 | connect(modelForDescription, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_modelForDescription_dataChanged(QModelIndex,QModelIndex))); |
|
- | 257 | ||
235 | }
|
258 | }
|
236 | 259 | ||
237 | 260 | ||
238 | 261 | ||
239 | 262 | ||
Строка 326... | Строка 349... | ||
326 | 349 | ||
327 | 350 | ||
328 | }
|
351 | }
|
329 | 352 | ||
330 | 353 | ||
- | 354 | void ClassEditor::addNewField(){ |
|
- | 355 | // QSqlRecord rec = mymodel->record(1);
|
|
- | 356 | //bool ok;
|
|
- | 357 | //ok = rec.isEmpty();
|
|
- | 358 | //QString currientClassID;
|
|
- | 359 | //currientClassID = rec.value(1).toString();
|
|
- | 360 | int row = modelForDescription->rowCount(); |
|
- | 361 | modelForDescription->insertRows(row, 1); |
|
- | 362 | modelForDescription->setData(modelForDescription->index(row, 5), QVariant(currClassID), Qt::EditRole); |
|
- | 363 | modelForDescription->setData(modelForDescription->index(row, 4), QVariant(tr("NULL")), Qt::EditRole); |
|
- | 364 | ||
- | 365 | modelForDescription->submitAll(); |
|
- | 366 | }
|
|
- | 367 | ||
- | 368 | ||
- | 369 | ||
- | 370 | ||
- | 371 | ||
- | 372 | ||
- | 373 | ||
- | 374 | ||
- | 375 | ||
- | 376 | ||
- | 377 | ||
331 | void ClassEditor::on_pushButton_clicked(){ |
378 | void ClassEditor::on_pushButton_clicked(){ |
332 | //int i;
|
379 | //int i;
|
333 | //i++;
|
380 | //i++;
|
334 | /////ClassEditor::addNewClass();
|
381 | /////ClassEditor::addNewClass();
|
335 | ClassEditor::addNewClass_new(); |
382 | ClassEditor::addNewClass_new(); |
Строка 341... | Строка 388... | ||
341 | void ClassEditor::on_tableView_clicked(const QModelIndex & index ){ |
388 | void ClassEditor::on_tableView_clicked(const QModelIndex & index ){ |
342 | int i, row, column; |
389 | int i, row, column; |
343 | i++; |
390 | i++; |
344 | row = index.row(); |
391 | row = index.row(); |
345 | column = index.column(); |
392 | column = index.column(); |
- | 393 | currIndexOfClassesTable = index; |
|
346 | QModelIndex index_tmp;
|
394 | QModelIndex index_tmp;
|
347 | QString tmp_str, filter_str;
|
395 | QString tmp_str, filter_str;
|
348 | index_tmp = ui->tableView->model()->index(row, 0); |
396 | index_tmp = ui->tableView->model()->index(row, 0); |
349 | tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
397 | tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
350 | //ui->label->setText(tmp_str);
|
398 | currClassID = tmp_str; |
- | 399 | // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
|
|
351 | filter_str = tr("ClassIdentifer = "); |
400 | filter_str = tr("ClassIdentifer = "); |
352 | filter_str.append(tmp_str); |
401 | filter_str.append(tmp_str); |
353 | modelForDescription->setFilter(filter_str); |
402 | modelForDescription->setFilter(filter_str); |
- | 403 | ui->tableView_2->resizeColumnsToContents(); |
|
354 | i++; |
404 | i++; |
355 | }
|
405 | }
|
356 | 406 | ||
357 | 407 | ||
358 | 408 | ||
Строка 363... | Строка 413... | ||
363 | }
|
413 | }
|
364 | 414 | ||
365 | void ClassEditor::on_pushButton_3_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Íîâîå ïîëå" |
415 | void ClassEditor::on_pushButton_3_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Íîâîå ïîëå" |
366 | int i; |
416 | int i; |
367 | i++; |
417 | i++; |
- | 418 | ClassEditor::addNewField(); |
|
- | 419 | ClassEditor::modelForDescription->select(); |
|
368 | }
|
420 | }
|
369 | void ClassEditor::on_pushButton_4_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü ïîëå" |
421 | void ClassEditor::on_pushButton_4_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü ïîëå" |
370 | int i; |
422 | int i; |
371 | i++; |
423 | i++; |
- | 424 | QModelIndex model_index;
|
|
- | 425 | QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
|
- | 426 | QModelIndexList indexes = selectionModel->selectedIndexes(); |
|
- | 427 | //model_index = mymodel->selec;
|
|
- | 428 | //modelList = ui->tableView->SelectItems;
|
|
- | 429 | i = indexes.size(); |
|
- | 430 | ||
- | 431 | if (i > 0) model_index = indexes.at(0); |
|
- | 432 | i++; |
|
- | 433 | }
|
|
- | 434 | ||
- | 435 | ||
- | 436 | void ClassEditor::on_myModel_dataChanged( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ |
|
- | 437 | int i; |
|
- | 438 | i++; |
|
- | 439 | ui->tableView->resizeColumnsToContents(); |
|
- | 440 | }
|
|
- | 441 | ||
- | 442 | void ClassEditor::on_modelForDescription_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ |
|
- | 443 | ui->tableView_2->resizeColumnsToContents(); |
|
372 | }
|
444 | }
|