From 08f30e3fa4b93c9d7cd6e7da0ecd75125f7d76e6 Mon Sep 17 00:00:00 2001
From: Gennady Pospelov <g.pospelov@fz-juelich.de>
Date: Tue, 17 May 2016 11:01:04 +0200
Subject: [PATCH] Blocked drag operation in the case of ParameterLabel item

---
 GUI/coregui/Models/ParameterTuningModel.cpp | 15 +++++++++++++++
 GUI/coregui/Models/ParameterTuningModel.h   |  1 +
 2 files changed, 16 insertions(+)

diff --git a/GUI/coregui/Models/ParameterTuningModel.cpp b/GUI/coregui/Models/ParameterTuningModel.cpp
index 7690f49777d..ad6c7ec8710 100644
--- a/GUI/coregui/Models/ParameterTuningModel.cpp
+++ b/GUI/coregui/Models/ParameterTuningModel.cpp
@@ -29,6 +29,21 @@ ParameterTuningModel::ParameterTuningModel(QObject *parent)
 
 }
 
+Qt::ItemFlags ParameterTuningModel::flags(const QModelIndex &proxyIndex) const
+{
+    Qt::ItemFlags result = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
+
+    QModelIndex sourceIndex = toSourceIndex(proxyIndex);
+    if(sourceIndex.isValid()) {
+        const QString modelType = sourceIndex.data(SessionModel::ModelTypeRole).toString();
+        if(modelType == Constants::ParameterType) {
+            result |= Qt::ItemIsDragEnabled;
+        }
+    }
+
+    return result;
+}
+
 QMimeData *ParameterTuningModel::mimeData(const QModelIndexList &proxyIndexes) const
 {
     qDebug() << "ParameterTuningModel::mimeData" << proxyIndexes;
diff --git a/GUI/coregui/Models/ParameterTuningModel.h b/GUI/coregui/Models/ParameterTuningModel.h
index 4b9c21b225d..b7a01c3f380 100644
--- a/GUI/coregui/Models/ParameterTuningModel.h
+++ b/GUI/coregui/Models/ParameterTuningModel.h
@@ -34,6 +34,7 @@ class BA_CORE_API_ ParameterTuningModel : public FilterPropertyProxy
 public:
     ParameterTuningModel(QObject *parent = 0);
 
+    Qt::ItemFlags flags(const QModelIndex &proxyIndex) const;
     QMimeData *mimeData(const QModelIndexList &proxyIndexes) const;
     Qt::DropActions supportedDragActions() const;
     Qt::DropActions supportedDropActions() const;
-- 
GitLab