Commit 45130497 authored by Marco Martin's avatar Marco Martin

allow word wrap in intro icons

also reduce icon sizes when needed
BUG:380972
parent d69ca2e8
...@@ -18,31 +18,39 @@ ...@@ -18,31 +18,39 @@
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Controls 2.0 as QQC2
import org.kde.kirigami 2.1 as Kirigami import org.kde.kirigami 2.1 as Kirigami
MouseArea { MouseArea {
id: root
property alias icon: iconItem.source property alias icon: iconItem.source
property alias text: label.text property alias text: label.text
property string module property string module
implicitWidth: column.implicitWidth property int iconSize: Kirigami.Units.iconSizes.huge
implicitHeight: column.implicitHeight Layout.minimumWidth: Kirigami.Units.iconSizes.large
Layout.minimumHeight: column.implicitHeight
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
onClicked: systemsettings.loadMostUsed(index); onClicked: systemsettings.loadMostUsed(index);
ColumnLayout { ColumnLayout {
id: column id: column
anchors.centerIn: parent width: parent.width
Kirigami.Icon { Kirigami.Icon {
id: iconItem id: iconItem
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
width: Kirigami.Units.iconSizes.huge Layout.minimumWidth: root.iconSize
Layout.minimumHeight: height
height: width height: width
} }
Kirigami.Label { QQC2.Label {
Layout.alignment: Qt.AlignHCenter
id: label id: label
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
} }
} }
Accessible.role: Accessible.Button Accessible.role: Accessible.Button
......
...@@ -59,6 +59,7 @@ Rectangle { ...@@ -59,6 +59,7 @@ Rectangle {
text: i18n("Frequently used:") text: i18n("Frequently used:")
} }
RowLayout { RowLayout {
id: iconsRow
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
spacing: Kirigami.Units.largeSpacing spacing: Kirigami.Units.largeSpacing
...@@ -68,6 +69,8 @@ Rectangle { ...@@ -68,6 +69,8 @@ Rectangle {
delegate: IntroIcon { delegate: IntroIcon {
icon: model.decoration icon: model.decoration
text: model.display text: model.display
iconSize: (iconsRow.width - iconsRow.spacing * 4) / 5 >= Kirigami.Units.iconSizes.huge ? Kirigami.Units.iconSizes.huge : Kirigami.Units.iconSizes.large
} }
} }
} }
......
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