aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/ios/ItemDelegate.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/quickcontrols/ios/ItemDelegate.qml')
-rw-r--r--src/quickcontrols/ios/ItemDelegate.qml56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/quickcontrols/ios/ItemDelegate.qml b/src/quickcontrols/ios/ItemDelegate.qml
new file mode 100644
index 0000000000..2b27c86b26
--- /dev/null
+++ b/src/quickcontrols/ios/ItemDelegate.qml
@@ -0,0 +1,56 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Templates as T
+import QtQuick.Controls.impl
+import QtQuick.Controls.iOS.impl
+
+T.ItemDelegate {
+ id: control
+
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
+ padding: 7
+ leftPadding: 16
+ rightPadding: 16
+ spacing: 14
+
+ icon.width: 29
+ icon.height: 29
+ icon.color: control.palette.text
+
+ contentItem: IconLabel {
+ spacing: control.spacing
+ mirrored: control.mirrored
+ display: control.display
+ alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft
+ icon: control.icon
+ text: control.text
+ font: control.font
+ color: control.palette.text
+ }
+
+ background: Rectangle {
+ implicitHeight: 44
+ color: Qt.styleHints.colorScheme === Qt.Dark ? control.palette.light : control.palette.base
+ NinePatchImage {
+ property real offset: control.icon.source.toString() !== "" ? control.icon.width + control.spacing : 0
+ x: control.down ? 0 : control.leftPadding + offset
+ y: control.down ? -1 : 0
+ height: control.height + (control.down ? 1 : 0)
+ width: control.down ? control.width : control.availableWidth + control.rightPadding - offset
+ source: IOS.url + "itemdelegate-background"
+ NinePatchImageSelector on source {
+ states: [
+ {"light": Qt.styleHints.colorScheme === Qt.Light},
+ {"dark": Qt.styleHints.colorScheme === Qt.Dark},
+ {"pressed": control.down}
+ ]
+ }
+ }
+ }
+}