Subversion Repositories OpenInventory

Rev

Rev 226 | Rev 233 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 226 Rev 227
Line 844... Line 844...
844
844
845
 void MainWindow::on_pushButton_9_clicked()// íàæàòèå êíîïêè "Äîáàâèòü ôèëüòð" (íà âêëàäêå ìîäåëåé)
845
 void MainWindow::on_pushButton_9_clicked()// íàæàòèå êíîïêè "Äîáàâèòü ôèëüòð" (íà âêëàäêå ìîäåëåé)
846
 {
846
 {
847
    QString class_id;
847
    QString class_id;
848
    QString model_id;
848
    QString model_id;
-
 
849
-
 
850
849
    class_id = ui->treeWidget->currentItem()->text(1);
851
    class_id = ui->treeWidget->currentItem()->text(1);
850
    model_id = ui->treeWidget->currentItem()->text(6);
852
    model_id = ui->treeWidget->currentItem()->text(6);
851
     int row = filter_model->rowCount();
853
     int row = filter_model->rowCount();
852
     filter_model->insertRows(row, 1);
854
     filter_model->insertRows(row, 1);
853
    filter_model->setData(filter_model->index(row, 1), QVariant(model_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "Model ID"
855
    filter_model->setData(filter_model->index(row, 1), QVariant(model_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "Model ID"
854
    filter_model->setData(filter_model->index(row, 2), QVariant(class_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "Class ID"
856
    filter_model->setData(filter_model->index(row, 2), QVariant(class_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "Class ID"
855
    ui->pushButton_11->setEnabled(true);
857
    ui->pushButton_11->setEnabled(true);
856
    ui->pushButton_12->setEnabled(true);
858
    ui->pushButton_12->setEnabled(true);
857
859
-
 
860
858
 }
861
 }
859
862
860
  void MainWindow::on_pushButton_10_clicked()// íàæàòèå êíîïêè "Óäàëèòü ôèëüòð" (íà âêëàäêå ôèëüòðîâ)
863
  void MainWindow::on_pushButton_10_clicked()// íàæàòèå êíîïêè "Óäàëèòü ôèëüòð" (íà âêëàäêå ôèëüòðîâ)
861
  {
864
  {
862
      QModelIndex model_index;
865
      QModelIndex model_index;
Line 885... Line 888...
885
      model_is_build = false;
888
      model_is_build = false;
886
      MainWindow::readModels();
889
      MainWindow::readModels();
887
      model_is_build = true;
890
      model_is_build = true;
888
      MainWindow::getDatabaseData();
891
      MainWindow::getDatabaseData();
889
892
-
 
893
      disconnect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex)));
-
 
894
    delete filter_model;
-
 
895
-
 
896
    filter_model = new QSqlTableModel();
-
 
897
     filter_model->setEditStrategy(QSqlTableModel::OnManualSubmit);
-
 
898
   /// filter_model = new MyModel();
-
 
899
-
 
900
    connect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex)));
-
 
901
-
 
902
-
 
903
-
 
904
890
  }
905
  }
891
906
892
  void MainWindow::on_pushButton_11_clicked()// íàæàòèå êíîïêè "Ïðèìåíèòü" (íà âêëàäêå ôèëüòðîâ)
907
  void MainWindow::on_pushButton_11_clicked()// íàæàòèå êíîïêè "Ïðèìåíèòü" (íà âêëàäêå ôèëüòðîâ)
893
  {
908
  {
894
      filter_model->submitAll();
909
      filter_model->submitAll();
Line 898... Line 913...
898
913
899
      model_is_build = false;
914
      model_is_build = false;
900
      MainWindow::readModels();
915
      MainWindow::readModels();
901
      model_is_build = true;
916
      model_is_build = true;
902
      MainWindow::getDatabaseData();
917
      MainWindow::getDatabaseData();
-
 
918
      disconnect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex)));
-
 
919
    delete filter_model;
-
 
920
-
 
921
    filter_model = new QSqlTableModel();
-
 
922
    filter_model->setEditStrategy(QSqlTableModel::OnManualSubmit);
-
 
923
   /// filter_model = new MyModel();
-
 
924
-
 
925
    connect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex)));
-
 
926
-
 
927
-
 
928
903
  }
929
  }
904
930
905
  void MainWindow::on_pushButton_12_clicked()// íàæàòèå êíîïêè "Ñáðîñèòü èçìåíåíèÿ" (íà âêëàäêå ôèëüòðîâ)
931
  void MainWindow::on_pushButton_12_clicked()// íàæàòèå êíîïêè "Ñáðîñèòü èçìåíåíèÿ" (íà âêëàäêå ôèëüòðîâ)
906
  {
932
  {
907
    ui->tableView_3->setModel(filter_model);
933
    ui->tableView_3->setModel(filter_model);
Line 1454... Line 1480...
1454
        result_str.append(Condition);
1480
        result_str.append(Condition);
1455
        result_str.append(tr(" `"));
1481
        result_str.append(tr(" `"));
1456
        result_str.append(FieldName);
1482
        result_str.append(FieldName);
1457
        result_str.append(tr("`"));
1483
        result_str.append(tr("`"));
1458
        result_str.append(ConditionalSymbol);
1484
        result_str.append(ConditionalSymbol);
-
 
1485
-
 
1486
        if  (!ValueForComparison.isEmpty())       {
1459
        result_str.append(tr("'"));
1487
                result_str.append(tr("'"));
1460
        result_str.append(ValueForComparison);
1488
                result_str.append(ValueForComparison);
1461
        result_str.append(tr("' "));
1489
                result_str.append(tr("' "));
-
 
1490
            }
1462
        result_str.append(PostCondition);
1491
        result_str.append(PostCondition);
1463
1492
1464
1493
1465
    }
1494
    }
1466
1495