Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 1821102b authored by Nicolas Carion's avatar Nicolas Carion

Transitions from list are now draggable

parent e5d3069d
......@@ -19,11 +19,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
import QtQuick 2.4
import QtQuick.Controls 1.4
import QtQuick 2.8
import QtQuick.Layouts 1.3
import QtQuick.Controls 1.5
import QtQuick.Controls.Styles 1.4
import QtQuick.Window 2.2
import QtQuick.Layouts 1.3
import QtQml.Models 2.2
Rectangle {
......@@ -161,28 +161,68 @@ Rectangle {
alternatingRowColors: false
headerVisible: false
backgroundVisible:false
itemDelegate: RowLayout {
Image{
visible: styleData.value != "root"
source: 'image://asseticon/' + styleData.value
itemDelegate: Rectangle {
id: assetDelegate
// These anchors are important to allow "copy" dragging
anchors.verticalCenter: parent ? parent.verticalCenter : undefined
anchors.right: parent ? parent.right : undefined
property bool isItem : styleData.value != "root"
width: text.implicitWidth + 20;
height: text.implicitHeight + 10
color:"transparent"
Drag.active: isItem ? dragArea.drag.active : false
Drag.dragType: Drag.Automatic
Drag.supportedActions: Qt.CopyAction
Drag.mimeData: {
"text/plain": "Copied text"
}
Row {
anchors.fill:parent
spacing: 2
Image{
visible: assetDelegate.isItem
source: 'image://asseticon/' + styleData.value
}
Label {
id: text
text: assetlist.getName(styleData.index)
}
}
Label{
text: assetlist.getName(styleData.index)
Layout.fillWidth: true
MouseArea {
id: dragArea
anchors.fill: parent
drag.target: parent
onPressed: {
if (isItem) {
assetDescription.text = assetlist.getDescription(styleData.index)
parent.grabToImage(function(result) {
parent.Drag.imageSource = result.url
})
} else {
if (treeView.isExpanded(styleData.index)) {
treeView.collapse(styleData.index)
} else {
treeView.expand(styleData.index)
}
}
}
}
}
TableViewColumn { role: "id"; title: "Name"; width: 200 }
TableViewColumn { role: "id"; title: "Name"; width: 700 }
model: assetListModel
selection: sel
onClicked:{
assetDescription.text = assetlist.getDescription(index)
}
}
TextArea {
id: assetDescription
text: ""
visible: false
readOnly: true
Layout.fillWidth: true
states: State {
name: "hasDescription"; when: assetDescription.text != '' && showDescription.checked
......
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