new_alterator/shared/TextWithHeader.qml
2022-07-11 15:47:26 +04:00

93 lines
2.0 KiB
QML

import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import Qt.labs.qmlmodels 1.0
import QtQml 2.15
Rectangle{
id: rect
property var keys
property var vals
property string headerS
property int n
property Component comp
Layout.minimumHeight: l1.height
Layout.maximumHeight: l1.height
Layout.fillWidth: true
ColumnLayout{
id: l1
width: parent.width
spacing: -7
RowLayout {
id: headerLayout
Layout.bottomMargin: 10
TextArea{
id: header
selectByMouse: true
selectByKeyboard: true
text: qsTr(headerS)
font.pointSize: 12
}
Rectangle{
Layout.fillWidth: true
Layout.minimumHeight: 1
Layout.maximumHeight: 1
Layout.topMargin: 4
color: "grey"
Layout.rightMargin: 10
}
}
RowLayout{
ColumnLayout{
spacing: -2
Repeater{
Layout.fillWidth: true
model: n
RowLayout{
Layout.leftMargin: 20
TextArea{
id: key
text: keys[index] + ":"
Layout.minimumWidth: 100
}
TextArea{
id: val
selectByMouse: true
selectByKeyboard: true
text: vals[index]
}
Item{
Layout.minimumWidth: 0
Layout.fillWidth: true
}
}
}
}
Loader{
Layout.rightMargin: 20
sourceComponent: comp
}
}
}
}