moment/src/qml/Base/HInterfaceBox.qml

65 lines
1.6 KiB
QML
Raw Normal View History

2019-07-08 13:52:41 +10:00
// Copyright 2019 miruka
// This file is part of harmonyqml, licensed under LGPLv3.
import QtQuick 2.12
import QtQuick.Layouts 1.12
HScalingBox {
id: interfaceBox
property alias title: interfaceTitle.text
property alias buttonModel: interfaceButtonsRepeater.model
property var buttonCallbacks: []
property string enterButtonTarget: ""
default property alias body: interfaceBody.children
function clickEnterButtonTarget() {
2019-07-18 19:18:13 +10:00
for (let i = 0; i < buttonModel.length; i++) {
let btn = interfaceButtonsRepeater.itemAt(i)
if (btn.name === enterButtonTarget) { btn.clicked() }
}
}
2019-04-29 02:47:51 +10:00
HColumnLayout {
anchors.fill: parent
id: mainColumn
HRowLayout {
Layout.alignment: Qt.AlignHCenter
Layout.margins: interfaceBox.margins
HLabel {
id: interfaceTitle
font.pixelSize: theme.fontSize.bigger
}
}
2019-04-29 05:22:53 +10:00
HSpacer {}
2019-04-28 11:07:20 +10:00
2019-04-29 02:47:51 +10:00
HColumnLayout { id: interfaceBody }
2019-04-29 05:22:53 +10:00
HSpacer {}
2019-04-28 11:07:20 +10:00
HRowLayout {
Repeater {
id: interfaceButtonsRepeater
model: []
2019-07-11 05:03:05 +10:00
HUIButton {
property string name: modelData.name
id: button
text: modelData.text
iconName: modelData.iconName || ""
enabled: modelData.enabled === false ? false : true
onClicked: buttonCallbacks[modelData.name](button)
Layout.fillWidth: true
Layout.preferredHeight: theme.avatar.size
}
}
}
}
}