Files
xtree.ng/qml/dummyview.qml
2025-08-26 19:41:28 +02:00

57 lines
1.3 KiB
QML

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Window
ApplicationWindow
{
visible: true
width: 600
height: 400
TreeView
{
anchors.fill: parent
clip: true
columnSpacing: 1
rowSpacing: 1
model: myChildModel
columnWidthProvider: function(column)
{
var z= 2*(width / columns);
console.log("Firz:", z);
console.log("Berechne Spaltenbreite für column:", column);
console.log("Aktuelle TreeView-Breite:", width);
return z;
}
delegate: Rectangle
{
required property int row
required property int column
required property var model
border.width: 0
implicitWidth: 30
implicitHeight: 30
border.color: "#cccccc"
//color: index % 2 === 0 ? "#f9f9f9" : "#e0e0e0"
color: TreeView.isSelected ? "#d0eaff" : (row % 2 === 0 ? "#f9f9f9" : "#ffffff")
Text
{
anchors.centerIn: parent
text: display
font.pixelSize: 14
}
}
ScrollBar.horizontal: ScrollBar {}
ScrollBar.vertical: ScrollBar {}
}
}