Commit aec08859 authored by Marco Martin's avatar Marco Martin

better layout management for intro icons

* scale them down to medium size
* after that if they still not fit, start to hide the last ones
parent 7ac9bc57
......@@ -28,7 +28,7 @@ MouseArea {
property alias text: label.text
property string module
property int iconSize: Kirigami.Units.iconSizes.huge
Layout.minimumWidth: Kirigami.Units.iconSizes.large
Layout.minimumWidth: Kirigami.Units.iconSizes.medium
Layout.minimumHeight: column.implicitHeight
cursorShape: Qt.PointingHandCursor
Layout.fillWidth: true
......@@ -42,7 +42,7 @@ MouseArea {
id: iconItem
Layout.alignment: Qt.AlignHCenter
Layout.minimumWidth: root.iconSize
Layout.minimumHeight: height
Layout.minimumHeight: Layout.minimumWidth
height: width
}
QQC2.Label {
......
......@@ -56,6 +56,7 @@ Rectangle {
Kirigami.Heading {
Layout.alignment: Qt.AlignHCenter
level: 3
wrapMode: Text.NoWrap
text: i18n("Frequently used:")
}
RowLayout {
......@@ -63,14 +64,20 @@ Rectangle {
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
spacing: Kirigami.Units.largeSpacing
property int spaceForIcon: Math.max((iconsRow.parent.width - iconsRow.spacing * 4) / 5, Kirigami.Units.iconSizes.medium)
property int iconSize: iconsRow.spaceForIcon >= Kirigami.Units.iconSizes.huge
? Kirigami.Units.iconSizes.huge
: (iconsRow.spaceForIcon >= Kirigami.Units.iconSizes.large ? Kirigami.Units.iconSizes.large : Kirigami.Units.iconSizes.medium)
Repeater {
model: systemsettings.mostUsedModel
delegate: IntroIcon {
icon: model.decoration
text: model.display
iconSize: (iconsRow.width - iconsRow.spacing * 4) / 5 >= Kirigami.Units.iconSizes.huge ? Kirigami.Units.iconSizes.huge : Kirigami.Units.iconSizes.large
iconSize: iconsRow.iconSize
Layout.minimumWidth: iconsRow.spaceForIcon
Layout.maximumWidth: Layout.minimumWidth
visible: (index + 1) * iconSize + index * iconsRow.spacing < iconsRow.parent.width
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment