Хранилища Subversion OpenInventory

Редакция

Редакция 67 | Редакция 69 | К новейшей редакции | Весь файл | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS

Редакция 67 Редакция 68
Строка 200... Строка 200...
200
200
201
201
202
//       model->setFilter(tr("Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = '7' and Èíâåíòàðíûé_íîìåð = 'i09090909'"));
202
//       model->setFilter(tr("Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = '7' and Èíâåíòàðíûé_íîìåð = 'i09090909'"));
203
////////////////////model->select();
203
////////////////////model->select();
204
mymodel->select();
204
mymodel->select();
205
modelForDescription->setFilter(tr("ClassIdentifer = 1"));
-
 
206
modelForDescription->select();
-
 
-
 
205
-
 
206
207
207
208
208
209
/////////////////////////model->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà"));
209
/////////////////////////model->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà"));
210
mymodel->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà"));
210
mymodel->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà"));
211
211
Строка 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;
-
 
259
QString str_fltr = tr("ClassIdentifer = ");
-
 
260
class_indx = mymodel->data(mymodel->index(0,0)).toString();
-
 
261
str_fltr.append(class_indx);
-
 
262
-
 
263
modelForDescription->setFilter(str_fltr);
-
 
264
modelForDescription->select();
-
 
265
-
 
266
258
267
259
//connect(ui->tableView, SIGNAL(clicked(const QModelIndex)), this, SLOT(on_tableView_clicked(const QModelIndex)));
268
//connect(ui->tableView, SIGNAL(clicked(const QModelIndex)), this, SLOT(on_tableView_clicked(const QModelIndex)));
260
connect(mymodel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_myModel_dataChanged(QModelIndex,QModelIndex)));
269
connect(mymodel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_myModel_dataChanged(QModelIndex,QModelIndex)));
261
connect(modelForDescription, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_modelForDescription_dataChanged(QModelIndex,QModelIndex)));
270
connect(modelForDescription, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_modelForDescription_dataChanged(QModelIndex,QModelIndex)));
262
connect(ui->newClassAction, SIGNAL(triggered(bool)), this, SLOT(on_pushButton_clicked(bool)));
271
connect(ui->newClassAction, SIGNAL(triggered(bool)), this, SLOT(on_pushButton_clicked(bool)));
263
connect(ui->action_ID, SIGNAL(triggered(bool)), this, SLOT(on_action_ID_triggered(bool)));
272
connect(ui->action_ID, SIGNAL(triggered(bool)), this, SLOT(on_action_ID_triggered(bool)));
264
connect(ui->action_showAlias, SIGNAL(triggered(bool)), this, SLOT(on_action_showAlias_triggered(bool)));
273
connect(ui->action_showAlias, SIGNAL(triggered(bool)), this, SLOT(on_action_showAlias_triggered(bool))); // ïîêàçûâàòü ïñåâäîíèìû
265
connect(ui->action_showInstance, SIGNAL(triggered(bool)), this, SLOT(on_action_showInstance_triggered(bool)));
274
connect(ui->action_showInstance, SIGNAL(triggered(bool)), this, SLOT(on_action_showInstance_triggered(bool))); // ïîêàçûâàòü õðàíèëèùà îáúåêòîâ
-
 
275
connect(ui->action_removeSelectedFields, SIGNAL(triggered()), this, SLOT(on_pushButton_4_clicked())); // óäàëèòü âûäåëåííûå ïîëÿ
-
 
276
connect(ui->action_removeAllFields, SIGNAL(triggered()), this, SLOT(on_pushButton_5_clicked())); // óäàëèòü âñå ïîëÿ
-
 
277
connect(ui->action_removeSelectedClasses, SIGNAL(triggered()), this, SLOT(on_pushButton_2_clicked())); // óäàëèòü âûäåëåííûå êëàññû
-
 
278
connect(ui->action_removeAllClasses, SIGNAL(triggered()), this, SLOT(on_action_removeAllClasses())); // óäàëèòü âûäåëåííûå êëàññû
266
}
279
}
267
280
268
281
269
282
270
283
Строка 380... Строка 393...
380
393
381
394
382
395
383
396
384
397
385
-
 
-
 
398
// äîáàâëÿåì íîâûé êëàññ
386
void ClassEditor::on_pushButton_clicked(){
399
void ClassEditor::on_pushButton_clicked(){
387
//int i;
400
//int i;
388
//i++;
401
//i++;
389
/////ClassEditor::addNewClass();
402
/////ClassEditor::addNewClass();
390
ClassEditor::addNewClass_new();
403
ClassEditor::addNewClass_new();
Строка 406... Строка 419...
406
   currClassID = tmp_str;
419
   currClassID = tmp_str;
407
  // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
420
  // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
408
   filter_str = tr("ClassIdentifer = ");
421
   filter_str = tr("ClassIdentifer = ");
409
   filter_str.append(tmp_str);
422
   filter_str.append(tmp_str);
410
   modelForDescription->setFilter(filter_str);
423
   modelForDescription->setFilter(filter_str);
-
 
424
   modelForDescription->select();
411
   ui->tableView_2->resizeColumnsToContents();
425
   ui->tableView_2->resizeColumnsToContents();
412
   i++;
426
   i++;
413
}
427
}
414
428
415
429
416
430
417
void ClassEditor::on_pushButton_2_clicked(){
431
void ClassEditor::on_pushButton_2_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïðêè "Óäàëèòü êëàññ"
-
 
432
    QModelIndex model_index;
-
 
433
    QItemSelectionModel *selectionModel = ui->tableView->selectionModel();
-
 
434
    QModelIndexList indexes = selectionModel->selectedIndexes();
-
 
435
    QList<int> selectedRows;
-
 
436
    selectedRows.clear();
-
 
437
    foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê
-
 
438
        if (!selectedRows.contains(model_index.row()) && (model_index.column()==1))  selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå
-
 
439
418
    int i;
440
    }
-
 
441
    qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå
-
 
442
-
 
443
-
 
444
    for (int m =0; m < selectedRows.size(); ++m){
-
 
445
-
 
446
     ClassEditor::removeClass(selectedRows.at(m));
-
 
447
-
 
448
-
 
449
419
    i++;
450
    }
-
 
451
 mymodel->submitAll();
-
 
452
    ClassEditor::modelForDescription->select();
420
453
421
}
454
}
422
455
423
void ClassEditor::on_pushButton_3_clicked(){         // îáðàáîò÷èê íàæàòèÿ êíîïêè "Íîâîå ïîëå"
456
void ClassEditor::on_pushButton_3_clicked(){         // îáðàáîò÷èê íàæàòèÿ êíîïêè "Íîâîå ïîëå"
424
    int i;
457
    int i;
425
    i++;
458
    i++;
426
    ClassEditor::addNewField();
459
    ClassEditor::addNewField();
427
    ClassEditor::modelForDescription->select();
460
    ClassEditor::modelForDescription->select();
428
    ui->tableView_2->resizeColumnsToContents();
461
    ui->tableView_2->resizeColumnsToContents();
429
}
462
}
-
 
463
-
 
464
430
void ClassEditor::on_pushButton_4_clicked(){         // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü ïîëå"
465
void ClassEditor::on_pushButton_4_clicked(){         // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü ïîëå"
431
    int i;
466
    int i;
432
    i++;
467
    i++;
433
    QModelIndex model_index;
468
    QModelIndex model_index;
434
    QItemSelectionModel *selectionModel = ui->tableView_2->selectionModel();
469
    QItemSelectionModel *selectionModel = ui->tableView_2->selectionModel();
Строка 492... Строка 527...
492
    if (is_checked) ui->tableView->showColumn(2);
527
    if (is_checked) ui->tableView->showColumn(2);
493
    else ui->tableView->hideColumn(2);
528
    else ui->tableView->hideColumn(2);
494
    ui->tableView->resizeColumnsToContents();
529
    ui->tableView->resizeColumnsToContents();
495
}
530
}
496
531
497
void ClassEditor::on_action_showInstance_triggered(bool is_checked){
532
void ClassEditor::on_action_showInstance_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü õðàíèëèùà îáúåêòîâ"
498
    if (is_checked) ui->tableView->showColumn(3);
533
    if (is_checked) ui->tableView->showColumn(3);
499
    else ui->tableView->hideColumn(3);
534
    else ui->tableView->hideColumn(3);
500
    ui->tableView->resizeColumnsToContents();
535
    ui->tableView->resizeColumnsToContents();
501
}
536
}
-
 
537
-
 
538
-
 
539
-
 
540
void ClassEditor::on_action_removeAllClasses(){ // îáðàáàòûâàåì âûáîð â ìåíþ "Óäàëèòü âñå êëàññû"
-
 
541
    int row;
-
 
542
    row = ClassEditor::mymodel->rowCount();
-
 
543
    for (int m=0; m < row; ++m){
-
 
544
    ClassEditor::removeClass(0);
-
 
545
    //ClassEditor::mymodel->removeRows(0, row);
-
 
546
}
-
 
547
    ClassEditor::mymodel->submitAll();
-
 
548
    ClassEditor::modelForDescription->select();
-
 
549
}
-
 
550
-
 
551
void ClassEditor::removeClass(int class_row){ // ôóíêöèÿ óäàëÿåò êëàññ, íàõîäÿùèéñÿ â ñòðîêå ñ íîìåðîì class_row
-
 
552
    QModelIndex index_tmp;
-
 
553
    QString tmp_str, filter_str;
-
 
554
   index_tmp = ui->tableView->model()->index(class_row, 0);
-
 
555
   tmp_str = ui->tableView->model()->data(index_tmp).toString();
-
 
556
   currClassID = tmp_str;
-
 
557
  // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
-
 
558
   filter_str = tr("ClassIdentifer = ");
-
 
559
   filter_str.append(tmp_str);
-
 
560
   modelForDescription->setFilter(filter_str); // îáíîâëÿåì òàáëèöó ïîëåé
-
 
561
    ClassEditor::on_pushButton_5_clicked(); // ñíà÷àëà óäàëèì âñå ïîëÿ êëàññà
-
 
562
     mymodel->removeRow(class_row); // òåïåðü óäàëÿåì ñàì êëàññ
-
 
563
     mymodel->submitAll(); // ôèêñèðóåì èçìåíåíèÿ
-
 
564
   ui->tableView->resizeColumnsToContents();
-
 
565
   ui->tableView_2->resizeColumnsToContents();
-
 
566
-
 
567
}