aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/material/SwipeDelegate.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-04-12 14:11:52 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-04-19 09:39:56 +0000
commit19a73f2c5824406021e2ea81b83dcc649a285168 (patch)
tree79e3398a3c0fa6e9d6165e3f1637ac68554f1eac /src/imports/controls/material/SwipeDelegate.qml
parent65247c0bbd340f4be89e0ae284b865fd8ba235ce (diff)
SwipeDelegate: add support for icons
Task-number: QTBUG-49820 Change-Id: I97bf3d048180c59c646eb9ae5f1c1a030c82f57d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/controls/material/SwipeDelegate.qml')
-rw-r--r--src/imports/controls/material/SwipeDelegate.qml19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/imports/controls/material/SwipeDelegate.qml b/src/imports/controls/material/SwipeDelegate.qml
index 8eaa5c12..c84ee702 100644
--- a/src/imports/controls/material/SwipeDelegate.qml
+++ b/src/imports/controls/material/SwipeDelegate.qml
@@ -36,6 +36,8 @@
import QtQuick 2.9
import QtQuick.Templates 2.3 as T
+import QtQuick.Controls 2.3
+import QtQuick.Controls.impl 2.3
import QtQuick.Controls.Material 2.3
import QtQuick.Controls.Material.impl 2.3
@@ -54,19 +56,22 @@ T.SwipeDelegate {
bottomPadding: 8
spacing: 16
+ icon.width: 24
+ icon.height: 24
+ icon.color: enabled ? undefined : Material.hintTextColor
+
swipe.transition: Transition { SmoothedAnimation { velocity: 3; easing.type: Easing.InOutCubic } }
- contentItem: Text {
- leftPadding: !control.mirrored ? (control.indicator ? control.indicator.width + control.spacing : 0) : 0
- rightPadding: control.mirrored ? (control.indicator ? control.indicator.width + control.spacing : 0) : 0
+ 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.enabled ? control.Material.foreground : control.Material.hintTextColor
- elide: Text.ElideRight
- visible: control.text
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
}
background: Rectangle {