Хранилища Subversion OpenInventory

Редакция

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

Редакция 180 Редакция 201
Строка 571... Строка 571...
571
571
572
572
573
   void IconDelegate::setTableView(QTableView* table){
573
   void IconDelegate::setTableView(QTableView* table){
574
       tblView = table;
574
       tblView = table;
575
   }
575
   }
-
 
576
-
 
577
-
 
578
-
 
579
-
 
580
-
 
581
-
 
582
-
 
583
-
 
584
   FileDelegate::FileDelegate( QObject * parent ) : QItemDelegate(parent)
-
 
585
   {
-
 
586
   }
-
 
587
-
 
588
-
 
589
-
 
590
-
 
591
-
 
592
   QWidget *FileDelegate::createEditor(QWidget *parent,
-
 
593
       const QStyleOptionViewItem &/* option */,
-
 
594
       const QModelIndex & /* index */) const
-
 
595
   {
-
 
596
-
 
597
       FileForm *editor = new FileForm(parent);
-
 
598
-
 
599
       return editor;
-
 
600
-
 
601
   }
-
 
602
-
 
603
-
 
604
-
 
605
-
 
606
   void FileDelegate::setEditorData(QWidget *editor,
-
 
607
                                       const QModelIndex &index) const
-
 
608
   {
-
 
609
-
 
610
-
 
611
       const QAbstractItemModel * model = index.model();
-
 
612
       FileForm *flFrm = static_cast<FileForm*>(editor);
-
 
613
       QVariant currentData = model->data(index,0);
-
 
614
       QByteArray bytes = currentData.toByteArray();
-
 
615
       if (currentData.isValid()) flFrm->setData(bytes);
-
 
616
       else return;
-
 
617
-
 
618
   }
-
 
619
-
 
620
-
 
621
-
 
622
-
 
623
void FileDelegate::setModelData(
-
 
624
               QWidget *editor,
-
 
625
               QAbstractItemModel *model,
-
 
626
               const QModelIndex& index) const {
-
 
627
       FileForm *flFrm = static_cast<FileForm*>(editor);
-
 
628
       if (!(flFrm->dataIsChanged())) return;
-
 
629
-
 
630
       m_Data = flFrm->data();
-
 
631
       if (!m_Data.isEmpty()) { // åñëè ìàññèâ íå ïóñòîé
-
 
632
                                   model->setData(index, QVariant (m_Data), Qt::EditRole);
-
 
633
-
 
634
                              }
-
 
635
       else {       // åñëè ìàññèâ ïóñòîé (ôàéë óäàëèëè)
-
 
636
           QVariant val_null;
-
 
637
           model->setData(index, val_null, Qt::EditRole);
-
 
638
-
 
639
            }
-
 
640
-
 
641
-
 
642
-
 
643
   }
-
 
644
-
 
645
-
 
646
-
 
647
   void FileDelegate::updateEditorGeometry(
-
 
648
               QWidget *editor,
-
 
649
               const QStyleOptionViewItem &option,
-
 
650
               const QModelIndex& /* index */) const {
-
 
651
-
 
652
-
 
653
   //    QRect r(option.rect.x() + option.rect.width()/2 - 7, option.rect.y() + option.rect.height()/2 - 7, 150, 100);
-
 
654
     //      editor->setGeometry(r);
-
 
655
-
 
656
        editor->setGeometry(option.rect);
-
 
657
   }
-
 
658
-
 
659
-
 
660
-
 
661