Paste P508

KDeclarative patch in support of D25785
ActivePublic

Authored by ngraham on Dec 14 2019, 2:16 PM.
diff --git a/src/qmlcontrols/kcmcontrols/qml/GridDelegate.qml b/src/qmlcontrols/kcmcontrols/qml/GridDelegate.qml
index 668a20f..9a5eced 100644
--- a/src/qmlcontrols/kcmcontrols/qml/GridDelegate.qml
+++ b/src/qmlcontrols/kcmcontrols/qml/GridDelegate.qml
@@ -39,6 +39,12 @@ T2.ItemDelegate {
*/
property string toolTip
+ /**
+ * subtitle: string
+ * optional string for the text to show below the main label
+ */
+ property string subtitle
+
/**
* thumbnail: Item
* the item actually implementing the thumbnail: the visualization is up to the implementation
@@ -72,7 +78,7 @@ T2.ItemDelegate {
}
width: Kirigami.Settings.isMobile ? delegate.width - Kirigami.Units.gridUnit : Math.min(delegate.GridView.view.implicitCellWidth, delegate.width - Kirigami.Units.gridUnit)
height: Kirigami.Settings.isMobile ? Math.round((delegate.width - Kirigami.Units.gridUnit) / 1.6)
- : Math.min(delegate.GridView.view.implicitCellHeight - Kirigami.Units.gridUnit * 2,
+ : Math.min(delegate.GridView.view.implicitCellHeight - Kirigami.Units.gridUnit * 3,
delegate.height - Kirigami.Units.gridUnit)
radius: Kirigami.Units.smallSpacing
Kirigami.Theme.inherit: false
@@ -176,12 +182,26 @@ T2.ItemDelegate {
left: thumbnail.left
right: thumbnail.right
top: thumbnail.bottom
- topMargin: Kirigami.Units.smallSpacing
+ topMargin: caption.visible ? Kirigami.Units.smallSpacing : Kirigami.Units.largeSpacing
}
text: delegate.text
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideRight
}
+ Controls.Label {
+ id: caption
+ visible: delegate.subtitle && delegate.subtitle.length > 0
+ opacity: 0.6
+ anchors {
+ left: thumbnail.left
+ right: thumbnail.right
+ top: label.bottom
+ }
+ text: delegate.subtitle
+ font.pointSize: theme.smallestFont.pointSize
+ horizontalAlignment: Text.AlignHCenter
+ elide: Text.ElideRight
+ }
Controls.ToolTip.delay: 1000
Controls.ToolTip.timeout: 5000
Controls.ToolTip.visible: hovered && delegate.toolTip.length > 0
diff --git a/src/qmlcontrols/kcmcontrols/qml/private/GridViewInternal.qml b/src/qmlcontrols/kcmcontrols/qml/private/GridViewInternal.qml
index 8c65082..b55dea3 100644
--- a/src/qmlcontrols/kcmcontrols/qml/private/GridViewInternal.qml
+++ b/src/qmlcontrols/kcmcontrols/qml/private/GridViewInternal.qml
@@ -25,7 +25,7 @@ import org.kde.kirigami 2.3 as Kirigami
GridView {
id: view
property int implicitCellWidth: Kirigami.Units.gridUnit * 10
- property int implicitCellHeight: Math.round(implicitCellWidth / 1.6) + Kirigami.Units.gridUnit*2
+ property int implicitCellHeight: Math.round(implicitCellWidth / 1.6) + Kirigami.Units.gridUnit*3
onCurrentIndexChanged: positionViewAtIndex(currentIndex, GridView.Contain);