Merge pull request #2815 from AIIX/Fix/SystemTextFrame

Bug Fix - Use the correct delegate, fix layouts, autofit text for System TextFrame
pull/2823/head
Kris Gesling 2021-02-01 11:57:00 +09:30 committed by GitHub
commit 8e51083882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 22 deletions

View File

@ -5,7 +5,7 @@ import org.kde.kirigami 2.4 as Kirigami
import Mycroft 1.0 as Mycroft import Mycroft 1.0 as Mycroft
Mycroft.ProportionalDelegate { Mycroft.Delegate {
id: systemTextFrame id: systemTextFrame
skillBackgroundColorOverlay: "#000000" skillBackgroundColorOverlay: "#000000"
property bool hasTitle: sessionData.title.length > 0 ? true : false property bool hasTitle: sessionData.title.length > 0 ? true : false
@ -13,27 +13,30 @@ Mycroft.ProportionalDelegate {
Component.onCompleted: { Component.onCompleted: {
console.log(hasTitle) console.log(hasTitle)
} }
Mycroft.AutoFitLabel { contentItem: ColumnLayout {
id: systemTextFrameTitle Label {
Layout.fillWidth: true id: systemTextFrameTitle
Layout.preferredHeight: proportionalGridUnit * 20 Layout.fillWidth: true
wrapMode: Text.Wrap font.pixelSize: Math.min(systemTextFrame.height/4, Math.max(systemTextFrame.height/10, systemTextFrameMainBody.fontInfo.pixelSize * 1.4))
visible: hasTitle wrapMode: Text.Wrap
enabled: hasTitle horizontalAlignment: Text.AlignHCenter
font.family: "Noto Sans" visible: hasTitle
font.weight: Font.Bold enabled: hasTitle
text: sessionData.title font.family: "Noto Sans"
} font.weight: Font.Bold
text: sessionData.title
Mycroft.AutoFitLabel { }
id: systemTextFrameMainBody
Layout.fillWidth: true Mycroft.AutoFitLabel {
Layout.preferredHeight: proportionalGridUnit * 30 id: systemTextFrameMainBody
wrapMode: Text.Wrap Layout.fillWidth: true
font.family: "Noto Sans" Layout.fillHeight: true
font.weight: Font.Bold wrapMode: Text.Wrap
text: sessionData.text font.family: "Noto Sans"
font.weight: Font.Bold
text: sessionData.text
}
} }
} }