Subversion Repositories OpenInventory

Rev

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

Rev 217 Rev 221
Line 814... Line 814...
814
 {
814
 {
815
    QString class_id;
815
    QString class_id;
816
    QString model_id;
816
    QString model_id;
817
    class_id = ui->treeWidget->currentItem()->text(1);
817
    class_id = ui->treeWidget->currentItem()->text(1);
818
    model_id = ui->treeWidget->currentItem()->text(6);
818
    model_id = ui->treeWidget->currentItem()->text(6);
819
     int row = filtr_model->rowCount();
819
     int row = filter_model->rowCount();
820
     filtr_model->insertRows(row, 1);
820
     filter_model->insertRows(row, 1);
821
    filtr_model->setData(filtr_model->index(row, 1), QVariant(model_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "Model ID"
821
    filter_model->setData(filter_model->index(row, 1), QVariant(model_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "Model ID"
822
    filtr_model->setData(filtr_model->index(row, 2), QVariant(class_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "Class ID"
822
    filter_model->setData(filter_model->index(row, 2), QVariant(class_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "Class ID"
823
    ui->pushButton_11->setEnabled(true);
823
    ui->pushButton_11->setEnabled(true);
824
    ui->pushButton_12->setEnabled(true);
824
    ui->pushButton_12->setEnabled(true);
825
825
826
 }
826
 }
827
827
828
  void MainWindow::on_pushButton_10_clicked()// íàæàòèå êíîïêè "Óäàëèòü ôèëüòð" (íà âêëàäêå ôèëüòðîâ)
828
  void MainWindow::on_pushButton_10_clicked()// íàæàòèå êíîïêè "Óäàëèòü ôèëüòð" (íà âêëàäêå ôèëüòðîâ)
829
  {
829
  {
-
 
830
      QModelIndex model_index;
-
 
831
      QItemSelectionModel *selectionModel = ui->tableView_3->selectionModel();
-
 
832
      QModelIndexList indexes = selectionModel->selectedIndexes();
-
 
833
      QList<int> selectedRows;
-
 
834
      selectedRows.clear();
-
 
835
      foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê
-
 
836
          if (!selectedRows.contains(model_index.row()) /*&& (model_index.column()==1)*/)  selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå
-
 
837
-
 
838
      }
-
 
839
      qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå
-
 
840
-
 
841
-
 
842
      for (int m =0; m < selectedRows.size(); ++m){
-
 
843
-
 
844
      // ClassEditor::removeClass(selectedRows.at(m));
-
 
845
-
 
846
      filter_model->removeRow(selectedRows.at(m));
-
 
847
-
 
848
      }
-
 
849
      filter_model->submitAll();
-
 
850
     // getDatabaseData();
830
851
831
  }
852
  }
832
853
833
  void MainWindow::on_pushButton_11_clicked()// íàæàòèå êíîïêè "Ïðèìåíèòü" (íà âêëàäêå ôèëüòðîâ)
854
  void MainWindow::on_pushButton_11_clicked()// íàæàòèå êíîïêè "Ïðèìåíèòü" (íà âêëàäêå ôèëüòðîâ)
834
  {
855
  {
835
      filtr_model->submitAll();
856
      filter_model->submitAll();
-
 
857
      ui->pushButton_11->setEnabled(false);
-
 
858
      ui->pushButton_12->setEnabled(false);
836
  }
859
  }
837
860
838
  void MainWindow::on_pushButton_12_clicked()// íàæàòèå êíîïêè "Ñáðîñèòü èçìåíåíèÿ" (íà âêëàäêå ôèëüòðîâ)
861
  void MainWindow::on_pushButton_12_clicked()// íàæàòèå êíîïêè "Ñáðîñèòü èçìåíåíèÿ" (íà âêëàäêå ôèëüòðîâ)
839
  {
862
  {
840
-
 
-
 
863
    filter_model->select();
-
 
864
    ui->pushButton_11->setEnabled(false);
-
 
865
    ui->pushButton_12->setEnabled(false);
841
  }
866
  }
842
867
843
868
844
void MainWindow::on_sql_mogel_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò
869
void MainWindow::on_sql_mogel_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò
845
int i;
870
int i;
Line 868... Line 893...
868
ui->pushButton_7->setEnabled(true);
893
ui->pushButton_7->setEnabled(true);
869
ui->pushButton_8->setEnabled(true);
894
ui->pushButton_8->setEnabled(true);
870
}
895
}
871
896
872
897
-
 
898
-
 
899
-
 
900
void MainWindow::on_filter_model_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ) // èçìåíèëè ñâîéñòâà ôèëüòðà èëè äîáàâèëè íîâûé ôèëüòð
-
 
901
-
 
902
{
-
 
903
    ui->pushButton_11->setEnabled(true);
-
 
904
    ui->pushButton_12->setEnabled(true);
-
 
905
}
-
 
906
-
 
907
-
 
908
-
 
909
-
 
910
873
// ïîëó÷àåì ñïèñîê âñåõ ïîëåé-óêàçàòåëåé, â êà÷åñòâå êëþ÷åé ïîëó÷èì èìåíà ïîëåé-óêàçàòåëåé
911
// ïîëó÷àåì ñïèñîê âñåõ ïîëåé-óêàçàòåëåé, â êà÷åñòâå êëþ÷åé ïîëó÷èì èìåíà ïîëåé-óêàçàòåëåé
874
// â êà÷åñòâå çíà÷åíèé ïîëó÷èì ñïèñîê òàáëèö-õðàíèëèù îáúåêòîâ ðîäèòåëüñêèõ êëàññîâ
912
// â êà÷åñòâå çíà÷åíèé ïîëó÷èì ñïèñîê òàáëèö-õðàíèëèù îáúåêòîâ ðîäèòåëüñêèõ êëàññîâ
875
913
876
QMap <QString, QString>  MainWindow::getPointersList(QString class_id){
914
QMap <QString, QString>  MainWindow::getPointersList(QString class_id){
877
    QMap <QString, QString>  result_map;
915
    QMap <QString, QString>  result_map;