Listview拖动节点交换数据、增删改除,挺实用的
import QtQuick 2.12
import QtQuick.Window 2.2
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11
Window{
id:topwindow
width: 800
height:800
flags: Qt.Window
visible: true
color: "#ffffff"
ListModel{
id: objmodel
}
ScrollView{
width: 200
height:300
clip: true
ListView {
id: listview
width: parent.width
height: parent.height
// focus: true
model:objmodel
delegate: Rectangle{
id:tttttt
width: parent.width
height: 30
color: listview.currentIndex==index ?"blue":"#999999"
property int myindex: index
Text {
id: coll
text: nodeName
color: "black"
font.pointSize:11