C
Qt Quick Ultralite loader Example
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
import QtQuick 2.15
import SettingsData
Row {
id: root
readonly property int optionWidth: SettingsData.settingsSelectorHeight * 0.8
readonly property int optionsSpacing: 5
readonly property int optionsCount: 4
height: SettingsData.settingsSelectorHeight
Text {
id: settingLabel
anchors.verticalCenter: parent.verticalCenter
text: "Background color: "
font: SettingsData.defaultFont
}
Rectangle {
id: optionsBackground
width: root.optionWidth * root.optionsCount + root.optionsSpacing * (root.optionsCount + 2) // +2 for margins
height: SettingsData.settingsSelectorHeight
color: SettingsData.highlightColor
Row {
anchors { centerIn: parent; leftMargin: root.optionsSpacing; rightMargin: root.optionsSpacing }
spacing: root.optionsSpacing
height: SettingsData.settingsSelectorHeight
Repeater {
model: ["#41CD52", "#3CC2C9", "#FFD952", "#FF5CD6"]
Rectangle {
color: (colorMa.pressed) ? SettingsData.highlightColor : modelData
height: root.optionWidth; width: height
radius: height / 2
anchors.verticalCenter: parent.verticalCenter
MouseArea {
id: colorMa
anchors.fill: parent
onClicked: SettingsData.backgroundColor = modelData
}
}
}
}
}
}