little breakthrought im QML Layouts
This commit is contained in:
65
qml/xqtableview.qml
Normal file
65
qml/xqtableview.qml
Normal file
@@ -0,0 +1,65 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
Window
|
||||
{
|
||||
width: 640
|
||||
height: 480
|
||||
visible: true
|
||||
title: qsTr("StringListModel")
|
||||
|
||||
TableView
|
||||
{
|
||||
id: childTableView
|
||||
anchors.fill: parent
|
||||
|
||||
model: myChildModel // z. B. QStandardItemModel mit 9 Spalten
|
||||
|
||||
delegate: Rectangle
|
||||
{
|
||||
required property string display
|
||||
|
||||
//height: 5
|
||||
//width: childTableView.width
|
||||
color : "blue"
|
||||
border.color: "#ccc"
|
||||
width: childTableView.width;
|
||||
|
||||
RowLayout
|
||||
{
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
|
||||
TextField
|
||||
{
|
||||
text : display
|
||||
font.pixelSize: 10
|
||||
Layout.fillWidth: true
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
color : "white"
|
||||
}
|
||||
|
||||
onEditingFinished:
|
||||
{
|
||||
console.log("Editing finished, new text is :"+ text + " at index :" + index)
|
||||
model.names = text //The roles here are defined in model class
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ScrollBar.horizontal: ScrollBar {}
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
|
||||
// // Optional: Spaltenbreiten setzen
|
||||
// onModelChanged: {
|
||||
// for (let i = 0; i < model.columns; ++i)
|
||||
// table.setColumnWidth(i, 100)
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user