summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lslayoutwindow.cpp4
-rw-r--r--lsscenemodel.cpp17
-rw-r--r--lsscenemodel.h3
3 files changed, 24 insertions, 0 deletions
diff --git a/lslayoutwindow.cpp b/lslayoutwindow.cpp
index 518d022..7360dcb 100644
--- a/lslayoutwindow.cpp
+++ b/lslayoutwindow.cpp
@@ -75,6 +75,10 @@ LSLayoutWindow::LSLayoutWindow(LYTPackageBase *pkg, const QString &layoutName, Q
m_widthBox->setValue(m_layout->width);
m_heightBox->setValue(m_layout->height);
+ m_sceneGraph->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ m_sceneGraph->setDragEnabled(true);
+ m_sceneGraph->setAcceptDrops(true);
+ m_sceneGraph->setDropIndicatorShown(true);
m_sceneGraph->setModel(new LSSceneModel(m_layout, this));
m_sceneGraph->expandAll();
diff --git a/lsscenemodel.cpp b/lsscenemodel.cpp
index 7450368..a5b6a23 100644
--- a/lsscenemodel.cpp
+++ b/lsscenemodel.cpp
@@ -58,3 +58,20 @@ QVariant LSSceneModel::data(const QModelIndex &index, int role) const {
}
return QVariant();
}
+
+
+Qt::ItemFlags LSSceneModel::flags(const QModelIndex &index) const {
+ Qt::ItemFlags flag;
+ flag = Qt::ItemIsEnabled | Qt::ItemIsSelectable |
+ Qt::ItemIsDropEnabled | Qt::ItemIsEditable;
+
+ if (index.isValid() && index.parent().isValid())
+ flag |= Qt::ItemIsDragEnabled;
+
+ return flag;
+}
+
+
+Qt::DropActions LSSceneModel::supportedDropActions() const {
+ return Qt::CopyAction | Qt::MoveAction;
+}
diff --git a/lsscenemodel.h b/lsscenemodel.h
index 3a26fc1..b53f6f6 100644
--- a/lsscenemodel.h
+++ b/lsscenemodel.h
@@ -17,6 +17,9 @@ public:
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
+ Qt::ItemFlags flags(const QModelIndex &index) const;
+ Qt::DropActions supportedDropActions() const;
+
private:
LYTLayout *m_layout;