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