looking better.
This commit is contained in:
@@ -8,7 +8,6 @@ ApplicationWindow
|
||||
visible: true
|
||||
width: 600
|
||||
height: 400
|
||||
title: "TableView mit myChildModel"
|
||||
|
||||
TreeView
|
||||
{
|
||||
@@ -19,27 +18,39 @@ ApplicationWindow
|
||||
|
||||
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
|
||||
{
|
||||
implicitWidth: 150
|
||||
implicitHeight: 40
|
||||
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 {
|
||||
Text
|
||||
{
|
||||
anchors.centerIn: parent
|
||||
text: display
|
||||
text: display
|
||||
font.pixelSize: 14
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ScrollBar.horizontal: ScrollBar {}
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
48
qml/xqtreeview.qml
Normal file
48
qml/xqtreeview.qml
Normal file
@@ -0,0 +1,48 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
|
||||
TreeView
|
||||
{
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
columnSpacing: 1
|
||||
rowSpacing: 1
|
||||
|
||||
model: xtrChildModel
|
||||
|
||||
columnWidthProvider: function(column)
|
||||
{
|
||||
var z= 1.7*(width / columns);
|
||||
console.log("höh!");
|
||||
return z;
|
||||
}
|
||||
|
||||
delegate: Rectangle
|
||||
{
|
||||
required property int row
|
||||
required property int column
|
||||
required property var model
|
||||
|
||||
border.width: 0
|
||||
|
||||
implicitWidth: 30
|
||||
implicitHeight: 20
|
||||
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: 12
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.horizontal: ScrollBar {}
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user