-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPalette.qml
38 lines (33 loc) · 870 Bytes
/
Palette.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import QtQuick 2.7
import QtQuick.Window 2.2
Rectangle {
id: palette
anchors.top: parent.top
anchors.topMargin: 4
anchors.right: parent.right
anchors.rightMargin: 4
width: 112
height: 40
color: "#ff555753"
property string pickedColor: "#055fcf"
property var colors: ["#055fcf", "#bfff00", "#f40039"]
Row{
anchors.centerIn: parent
spacing: 4
Repeater{
model: colors
delegate: Rectangle{
width: 32
height: 32
color: modelData
border.width: 2
border.color: (color == palette.pickedColor) ? Qt.lighter(color) : palette.color
MouseArea{
anchors.fill: parent
onClicked: {
palette.pickedColor = parent.color
}
}
}
} }
}