aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/doc/snippets/qtquickcontrols-swipedelegate-custom.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/quickcontrols/doc/snippets/qtquickcontrols-swipedelegate-custom.qml')
-rw-r--r--src/quickcontrols/doc/snippets/qtquickcontrols-swipedelegate-custom.qml48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/quickcontrols/doc/snippets/qtquickcontrols-swipedelegate-custom.qml b/src/quickcontrols/doc/snippets/qtquickcontrols-swipedelegate-custom.qml
new file mode 100644
index 0000000000..4382e5f9ec
--- /dev/null
+++ b/src/quickcontrols/doc/snippets/qtquickcontrols-swipedelegate-custom.qml
@@ -0,0 +1,48 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+//! [file]
+import QtQuick
+import QtQuick.Controls
+
+SwipeDelegate {
+ id: control
+ text: qsTr("SwipeDelegate")
+
+ Component {
+ id: component
+
+ Rectangle {
+ color: SwipeDelegate.pressed ? "#333" : "#444"
+ width: parent.width
+ height: parent.height
+ clip: true
+
+ Label {
+ text: qsTr("Press me!")
+ color: "#21be2b"
+ anchors.centerIn: parent
+ }
+ }
+ }
+
+ swipe.left: component
+ swipe.right: component
+
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ color: control.enabled ? (control.down ? "#17a81a" : "#21be2b") : "#bdbebf"
+ elide: Text.ElideRight
+ verticalAlignment: Text.AlignVCenter
+
+ Behavior on x {
+ enabled: !control.down
+ NumberAnimation {
+ easing.type: Easing.InOutCubic
+ duration: 400
+ }
+ }
+ }
+}
+//! [file]