WIP: Add word wrap #22

Draft
Toast wants to merge 3 commits from wordWrap into main

View file

@ -35,6 +35,7 @@ Kirigami.ApplicationWindow {
component ModCardDelegate: Kirigami.AbstractCard { component ModCardDelegate: Kirigami.AbstractCard {
required property QMod mod required property QMod mod
id: card
showClickFeedback: true showClickFeedback: true
onClicked: pageStack.push(Qt.resolvedUrl("ModPage.qml"), { onClicked: pageStack.push(Qt.resolvedUrl("ModPage.qml"), {
mod: mod mod: mod
@ -74,6 +75,25 @@ Kirigami.ApplicationWindow {
Layout.fillWidth: true Layout.fillWidth: true
text: mod.name text: mod.name
type: Kirigami.Heading.Type.Primary type: Kirigami.Heading.Type.Primary
wrapMode: Text.WordWrap
maximumLineCount: 2
elide: Text.ElideRight
// https://stackoverflow.com/a/50504960
Controls.ToolTip.visible: labelArea.containsMouse && truncated
Controls.ToolTip.text: mod.name
Controls.ToolTip.delay: Kirigami.Units.toolTipDelay
MouseArea {
id: labelArea
anchors.fill: parent
hoverEnabled: true
// For some reason I can't connect the pressed signals, so there's no feedback for that
// Whoops
Component.onCompleted: {
clicked.connect(card.clicked)
}
}
} }
Kirigami.Separator { Kirigami.Separator {
Layout.fillWidth: true Layout.fillWidth: true
@ -85,6 +105,9 @@ Kirigami.ApplicationWindow {
font.italic: desc ? false : true font.italic: desc ? false : true
text: desc ? desc : "No description available" text: desc ? desc : "No description available"
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
maximumLineCount: 6
elide: Text.ElideRight
} }
} }
ColumnLayout { ColumnLayout {