aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/doc/snippets/qtquickcontrols-itemdelegate-custom.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/quickcontrols/doc/snippets/qtquickcontrols-itemdelegate-custom.qml')
-rw-r--r--src/quickcontrols/doc/snippets/qtquickcontrols-itemdelegate-custom.qml35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/quickcontrols/doc/snippets/qtquickcontrols-itemdelegate-custom.qml b/src/quickcontrols/doc/snippets/qtquickcontrols-itemdelegate-custom.qml
new file mode 100644
index 0000000000..8dcc860dd7
--- /dev/null
+++ b/src/quickcontrols/doc/snippets/qtquickcontrols-itemdelegate-custom.qml
@@ -0,0 +1,35 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+//! [file]
+import QtQuick
+import QtQuick.Controls
+
+ItemDelegate {
+ id: control
+ text: qsTr("ItemDelegate")
+
+ contentItem: Text {
+ rightPadding: control.spacing
+ text: control.text
+ font: control.font
+ color: control.enabled ? (control.down ? "#17a81a" : "#21be2b") : "#bdbebf"
+ elide: Text.ElideRight
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 40
+ opacity: enabled ? 1 : 0.3
+ color: control.down ? "#dddedf" : "#eeeeee"
+
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: control.down ? "#17a81a" : "#21be2b"
+ anchors.bottom: parent.bottom
+ }
+ }
+}
+//! [file]