aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/ItemDelegate.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-05 13:33:08 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-06 13:16:14 +0000
commit54efc8f33d9c37e8912f5755af588817192a869d (patch)
tree31bc7b81e95ffccb0e2948f44898941ca49f46c1 /src/imports/controls/ItemDelegate.qml
parent802f6b747f4cd76bda4395b6bc06dec81da1110c (diff)
ItemDelegate: migrate from label to contentItem
Change-Id: I928192b1b5d31e077032cba31f1bde3bf35491f3 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/imports/controls/ItemDelegate.qml')
-rw-r--r--src/imports/controls/ItemDelegate.qml20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/imports/controls/ItemDelegate.qml b/src/imports/controls/ItemDelegate.qml
index b5dfb4b6..13a13e1e 100644
--- a/src/imports/controls/ItemDelegate.qml
+++ b/src/imports/controls/ItemDelegate.qml
@@ -41,23 +41,19 @@ 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
padding: 12
spacing: 12
- //! [label]
- label: Text {
- x: control.mirrored ? control.width - width - control.rightPadding : control.leftPadding
- y: control.topPadding
- width: control.availableWidth - (control.checkable ? indicator.width + control.spacing : 0)
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.checkable && control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.checkable && !control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -67,7 +63,7 @@ T.ItemDelegate {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
+ //! [contentItem]
//! [indicator]
indicator: Image {