aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/universal/ItemDelegate.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/controls/universal/ItemDelegate.qml')
-rw-r--r--src/imports/controls/universal/ItemDelegate.qml54
1 files changed, 18 insertions, 36 deletions
diff --git a/src/imports/controls/universal/ItemDelegate.qml b/src/imports/controls/universal/ItemDelegate.qml
index 2aaf270b..6822d658 100644
--- a/src/imports/controls/universal/ItemDelegate.qml
+++ b/src/imports/controls/universal/ItemDelegate.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,44 +35,28 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.ItemDelegate {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (label ? label.implicitWidth : 0) +
- (indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(label ? label.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ baselineOffset: contentItem.y + contentItem.baselineOffset
spacing: 12
- topPadding: 11
- leftPadding: 12
- rightPadding: 12
- bottomPadding: 13
+ padding: 12
+ topPadding: padding - 1
+ bottomPadding: padding + 1
- //! [indicator]
- indicator: Image {
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
- y: control.topPadding + (control.availableHeight - height) / 2
-
- visible: control.checked
- source: !control.checkable ? "" : "image://universal/checkmark/" + (!control.enabled ? control.Universal.baseLowColor : control.pressed ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor)
- }
- //! [indicator]
-
- //! [label]
- label: Text {
- x: control.mirrored || !control.checkable ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
- y: control.topPadding
- width: control.availableWidth - (control.checkable ? indicator.width + control.spacing : 0)
- height: control.availableHeight
+ contentItem: Text {
+ leftPadding: !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
+ rightPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
text: control.text
font: control.font
@@ -81,22 +65,20 @@ T.ItemDelegate {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
- color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
}
- //! [label]
- //! [background]
background: Rectangle {
- visible: control.pressed || control.highlighted || control.activeFocus
- color: control.pressed ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+ visible: control.down || control.highlighted || control.visualFocus
+ color: control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
Rectangle {
width: parent.width
height: parent.height
- visible: control.activeFocus || control.highlighted
+ visible: control.visualFocus || control.highlighted
color: control.Universal.accent
opacity: control.Universal.theme === Universal.Light ? 0.4 : 0.6
}
}
- //! [background]
}