Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Bug Fix - Use the correct delegate, fix layouts, autofit text for System TextFrame #2815

Merged
merged 1 commit into from
Feb 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 25 additions & 22 deletions mycroft/res/ui/SYSTEM_TextFrame.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,38 @@ 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

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
}
}
}