From 1c0e5c665f9a716131567f6dc011e6c7be48ceff Mon Sep 17 00:00:00 2001
From: Olivier Langella <Olivier.Langella@moulon.inra.fr>
Date: Fri, 28 Jul 2017 09:13:10 +0200
Subject: [PATCH] WIP: new ptm sequence delegate

---
 .../ptmsequencedelegate.cpp                   | 19 +++++++++++--------
 .../ptmsequencedelegate.h                     | 14 +++++++-------
 2 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/src/gui/ptm_peptide_list_view/ptmsequencedelegate.cpp b/src/gui/ptm_peptide_list_view/ptmsequencedelegate.cpp
index 371eb352..f7a38cc7 100644
--- a/src/gui/ptm_peptide_list_view/ptmsequencedelegate.cpp
+++ b/src/gui/ptm_peptide_list_view/ptmsequencedelegate.cpp
@@ -27,6 +27,8 @@
 ******************************************************************************/
 
 #include "ptmsequencedelegate.h"
+#include "../../grouping/ptm/ptmsamplescan.h"
+#include <QTextEdit>
 
 PtmSequenceDelegate::PtmSequenceDelegate(QWidget *parent) : QStyledItemDelegate(parent) {
     
@@ -35,15 +37,16 @@ PtmSequenceDelegate::PtmSequenceDelegate(QWidget *parent) : QStyledItemDelegate(
 void PtmSequenceDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
                          const QModelIndex &index) const
 {
-    /*if (index.data().canConvert<StarRating>()) {
-        StarRating starRating = qvariant_cast<StarRating>(index.data());
+    if (index.data().canConvert<PtmSampleScan *>()) {
+        PtmSampleScan * p_ptm_sample_scan = qvariant_cast<PtmSampleScan *>(index.data());
 
-        if (option.state & QStyle::State_Selected)
-            painter->fillRect(option.rect, option.palette.highlight());
+       // if (option.state & QStyle::State_Selected)
+        //    painter->fillRect(option.rect, option.palette.highlight());
+        //QTextEdit edit;
 
-        starRating.paint(painter, option.rect, option.palette,
-                         StarRating::ReadOnly);
-    } else {*/
+        //edit..paint(painter, option.rect, option.palette,
+        //                 StarRating::ReadOnly);
+    } else {
         QStyledItemDelegate::paint(painter, option, index);
-    //}
+    }
 }
diff --git a/src/gui/ptm_peptide_list_view/ptmsequencedelegate.h b/src/gui/ptm_peptide_list_view/ptmsequencedelegate.h
index 526092fa..a8235a69 100644
--- a/src/gui/ptm_peptide_list_view/ptmsequencedelegate.h
+++ b/src/gui/ptm_peptide_list_view/ptmsequencedelegate.h
@@ -40,13 +40,13 @@ public:
 
     void paint(QPainter *painter, const QStyleOptionViewItem &option,
                const QModelIndex &index) const override;
-    QSize sizeHint(const QStyleOptionViewItem &option,
-                   const QModelIndex &index) const override;
-    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
-                          const QModelIndex &index) const override;
-    void setEditorData(QWidget *editor, const QModelIndex &index) const override;
-    void setModelData(QWidget *editor, QAbstractItemModel *model,
-                      const QModelIndex &index) const override;
+    //QSize sizeHint(const QStyleOptionViewItem &option,
+     //              const QModelIndex &index) const override;
+    //QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
+    //                      const QModelIndex &index) const override;
+    //void setEditorData(QWidget *editor, const QModelIndex &index) const override;
+    //void setModelData(QWidget *editor, QAbstractItemModel *model,
+    //                  const QModelIndex &index) const override;
 
 };
 #endif // PTMSEQUENCEDELEGATE_H
-- 
GitLab