diff options
Diffstat (limited to 'tests/manual/quickcontrols/gifs/data/qtquickcontrols2-tumbler-wrap.qml')
-rw-r--r-- | tests/manual/quickcontrols/gifs/data/qtquickcontrols2-tumbler-wrap.qml | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/manual/quickcontrols/gifs/data/qtquickcontrols2-tumbler-wrap.qml b/tests/manual/quickcontrols/gifs/data/qtquickcontrols2-tumbler-wrap.qml new file mode 100644 index 0000000000..1d6832bbc2 --- /dev/null +++ b/tests/manual/quickcontrols/gifs/data/qtquickcontrols2-tumbler-wrap.qml @@ -0,0 +1,57 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Window +import QtQuick.Controls + +Window { + width: frame.implicitWidth + 10 + height: frame.implicitHeight + 10 + visible: true + + function formatText(count, modelData) { + var data = count === 12 ? modelData + 1 : modelData; + return data.toString().length < 2 ? "0" + data : data; + } + + Component { + id: delegateComponent + + Label { + text: formatText(Tumbler.tumbler.count, modelData) + opacity: 1.0 - Math.abs(Tumbler.displacement) / (Tumbler.tumbler.visibleItemCount / 2) + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + } + + Frame { + id: frame + padding: 0 + anchors.centerIn: parent + + Row { + id: row + + Tumbler { + id: hoursTumbler + model: 12 + delegate: delegateComponent + } + + Tumbler { + id: minutesTumbler + model: 60 + delegate: delegateComponent + } + + Tumbler { + id: amPmTumbler + wrap: false + model: ["AM", "PM"] + delegate: delegateComponent + } + } + } +} |