Commit 01e54c5c authored by Ronan Abhamon's avatar Ronan Abhamon

feat(src/components/codecs/CodecsModel): in progress

parent 336abb50
import QtQml.Models 2.2
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
...@@ -7,7 +8,7 @@ import Linphone.Styles 1.0 ...@@ -7,7 +8,7 @@ import Linphone.Styles 1.0
// ============================================================================= // =============================================================================
Column { Column {
property alias model: view.model property alias model: visualModel.model
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Header. // Header.
...@@ -72,14 +73,40 @@ Column { ...@@ -72,14 +73,40 @@ Column {
height: count * CodecsViewerStyle.attribute.height height: count * CodecsViewerStyle.attribute.height
delegate: Rectangle { model: DelegateModel {
color: 'transparent' id: visualModel
delegate: MouseArea {
id: dragArea
property bool held: false
anchors {
left: parent.left
right: parent.right
}
drag {
axis: Drag.YAxis
target: held ? content : undefined
}
height: CodecsViewerStyle.attribute.height height: CodecsViewerStyle.attribute.height
width: parent.width
onPressAndHold: held = true
onReleased: held = false
RowLayout { RowLayout {
anchors.fill: parent id: content
Drag.active: dragArea.held
Drag.source: dragArea
Drag.hotSpot.x: width / 2
Drag.hotSpot.y: height / 2
height: dragArea.height
width: dragArea.width
spacing: CodecsViewerStyle.column.spacing spacing: CodecsViewerStyle.column.spacing
CodecAttribute { CodecAttribute {
...@@ -114,10 +141,16 @@ Column { ...@@ -114,10 +141,16 @@ Column {
} }
} }
MouseArea { DropArea {
id: mouseArea
anchors.fill: parent anchors.fill: parent
onEntered: {
visualModel.items.move(
drag.source.DelegateModel.itemsIndex,
dragArea.DelegateModel.itemsIndex
)
}
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment