2022-05-13 13:12:05 +00:00
|
|
|
// Copyright (C) 2021 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2012-02-28 03:20:56 +00:00
|
|
|
|
2023-03-30 07:12:28 +00:00
|
|
|
pragma ComponentBehavior: Bound
|
2021-08-23 13:14:25 +00:00
|
|
|
import QtQuick
|
2011-11-22 04:27:34 +00:00
|
|
|
|
|
|
|
Item {
|
2012-02-28 03:20:56 +00:00
|
|
|
id: selector
|
2023-03-30 07:12:28 +00:00
|
|
|
|
2012-02-28 03:20:56 +00:00
|
|
|
property int curIdx: 0
|
|
|
|
property int maxIdx: 3
|
|
|
|
property int gridWidth: 240
|
|
|
|
property Flickable flickable
|
|
|
|
width: parent.width
|
|
|
|
height: 64
|
|
|
|
function advance(steps) {
|
2023-03-30 07:12:28 +00:00
|
|
|
const nextIdx = curIdx + steps
|
2012-02-28 03:20:56 +00:00
|
|
|
if (nextIdx < 0 || nextIdx > maxIdx)
|
2023-03-30 07:12:28 +00:00
|
|
|
return
|
|
|
|
flickable.contentX += gridWidth * steps
|
|
|
|
curIdx += steps
|
2011-11-22 04:27:34 +00:00
|
|
|
}
|
2012-02-28 03:20:56 +00:00
|
|
|
Image {
|
2021-08-31 15:54:15 +00:00
|
|
|
source: "pics/arrow.png"
|
2012-02-28 03:20:56 +00:00
|
|
|
MouseArea{
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: selector.advance(-1)
|
2011-11-22 04:27:34 +00:00
|
|
|
}
|
2012-02-28 03:20:56 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 8
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
opacity: selector.curIdx == 0 ? 0.2 : 1.0
|
|
|
|
Behavior on opacity {NumberAnimation{}}
|
|
|
|
}
|
|
|
|
Image {
|
2021-08-31 15:54:15 +00:00
|
|
|
source: "pics/arrow.png"
|
2012-02-28 03:20:56 +00:00
|
|
|
mirror: true
|
|
|
|
MouseArea{
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: selector.advance(1)
|
2011-11-22 04:27:34 +00:00
|
|
|
}
|
2012-02-28 03:20:56 +00:00
|
|
|
opacity: selector.curIdx == selector.maxIdx ? 0.2 : 1.0
|
|
|
|
Behavior on opacity {NumberAnimation{}}
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 8
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
Repeater {
|
|
|
|
model: [ "Scale", "Repeat", "Scale/Repeat", "Round" ]
|
|
|
|
delegate: Text {
|
2019-09-17 16:10:59 +00:00
|
|
|
required property string modelData
|
|
|
|
required property int index
|
|
|
|
|
|
|
|
text: modelData
|
2012-02-28 03:20:56 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
|
|
x: (index - selector.curIdx) * 80 + 140
|
|
|
|
Behavior on x { NumberAnimation{} }
|
|
|
|
|
|
|
|
opacity: selector.curIdx == index ? 1.0 : 0.0
|
|
|
|
Behavior on opacity { NumberAnimation{} }
|
2011-11-22 04:27:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|