opaque/Setting.qml

75 lines
1.7 KiB
QML
Raw Normal View History

import QtGraphicalEffects 1.0
import QtQuick 2.7
import QtQuick.Controls 2.4
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
import QtQuick.Window 2.11
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "." as Opaque
import "../opaque/styles"
import "../opaque/theme"
Column {
id: tehcol
2020-12-15 01:16:49 +00:00
width: parent.width - 2 * parent.padding
anchors.horizontalCenter: parent.horizontalCenter
2020-12-15 01:16:49 +00:00
spacing: Theme.paddingSmall
property bool inline: true
property bool last: false
property alias label: settingLabel.text
2020-07-08 22:30:15 +00:00
property alias description: settingDescriptionLabel.text
property alias field: fieldContainer.children
Grid {
id: container
columns: inline ? 2 : 1
2020-12-15 01:16:49 +00:00
spacing: Theme.paddingStandard
padding: Theme.paddingStandard
width: parent.width
2020-12-15 01:16:49 +00:00
property int gridWidth: (inline ? (width - spacing)/2 : width) - 2*padding
anchors.horizontalCenter: parent.horizontalCenter
2020-07-08 22:30:15 +00:00
Column {
2020-12-15 01:16:49 +00:00
Opaque.Label {
2020-07-08 22:30:15 +00:00
id: settingLabel
width: container.gridWidth
2020-12-15 01:16:49 +00:00
header: true
visible: text != ""
2020-07-08 22:30:15 +00:00
}
2020-12-15 01:16:49 +00:00
Opaque.Label {
2020-07-08 22:30:15 +00:00
id: settingDescriptionLabel
width: container.gridWidth
2020-12-15 01:16:49 +00:00
size: Theme.textSmallPt
2020-07-08 22:30:15 +00:00
visible: settingDescriptionLabel.text != ""
topPadding:10
}
}
Item {
id: fieldContainer
width: container.gridWidth
// needs a height so !inline HLine "knows" how far down to be
height: fieldContainer.children[0].height
}
}
2020-12-15 01:16:49 +00:00
Opaque.HLine {
width: parent.width - 20
visible: !last
}
}