ActiveWindow fully debugged

This commit is contained in:
quadbyte 2025-08-16 23:12:14 -04:00
parent fbfda31733
commit 2b1893f8bc

View file

@ -7,7 +7,7 @@ import qs.Services
import qs.Widgets import qs.Widgets
Row { Row {
id: layout id: root
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
spacing: Style.marginSmall * scaling spacing: Style.marginSmall * scaling
visible: Settings.data.bar.showActiveWindow visible: Settings.data.bar.showActiveWindow
@ -22,7 +22,6 @@ Row {
repeat: false repeat: false
onTriggered: { onTriggered: {
showingFullTitle = false showingFullTitle = false
// No need to update text here, the width property change will handle it
} }
} }
@ -56,13 +55,13 @@ Row {
NText { NText {
id: fullTitleMetrics id: fullTitleMetrics
visible: false visible: false
text: getTitle() text: titleText.text
font: titleText.font font: titleText.font
} }
Rectangle { Rectangle {
// Let the Rectangle size itself based on its content (the Row) // Let the Rectangle size itself based on its content (the Row)
width: row.width + Style.marginMedium* scaling * 2 width: row.width + Style.marginMedium * scaling * 2
height: row.height + Style.marginSmall * scaling height: row.height + Style.marginSmall * scaling
color: Color.mSurfaceVariant color: Color.mSurfaceVariant
radius: Style.radiusSmall * scaling radius: Style.radiusSmall * scaling
@ -92,7 +91,11 @@ Row {
NText { NText {
id: titleText id: titleText
width: (showingFullTitle || mouseArea.containsMouse) ? fullTitleMetrics.contentWidth : 150 * scaling
// If hovered or just switched window, show up to 300 pixels
// If not hovered show up to 150 pixels
width: (showingFullTitle || mouseArea.containsMouse) ? Math.min(fullTitleMetrics.contentWidth, 300 * scaling) : Math.min(
fullTitleMetrics.contentWidth, 150 * scaling)
text: getTitle() text: getTitle()
font.pointSize: Style.fontSizeReduced * scaling font.pointSize: Style.fontSizeReduced * scaling
font.weight: Style.fontWeightBold font.weight: Style.fontWeightBold
@ -104,7 +107,7 @@ Row {
Behavior on width { Behavior on width {
NumberAnimation { NumberAnimation {
duration: Style.animationSlow duration: Style.animationSlow
easing.type: Easing.OutBack easing.type: Easing.InOutCubic
} }
} }
} }