ActiveWindo/MediaMini: slight width improvements
This commit is contained in:
parent
68a44b6ef7
commit
ab4359b624
2 changed files with 23 additions and 15 deletions
|
|
@ -12,17 +12,14 @@ Row {
|
|||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
// Title stays collapsed by default; expands only on hover
|
||||
property bool showingFullTitle: false
|
||||
readonly property int minWidth: 120
|
||||
readonly property real minWidth: 160
|
||||
readonly property real maxWidth: 400
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Style.marginS * scaling
|
||||
visible: getTitle() !== ""
|
||||
|
||||
// Remove auto-expand timer; we rely solely on hover
|
||||
|
||||
// No auto-expansion on window change; keep collapsed unless hovered
|
||||
function getTitle() {
|
||||
// Use the service's focusedWindowTitle property which is updated immediately
|
||||
// when WindowOpenedOrChanged events are received
|
||||
|
|
@ -49,7 +46,7 @@ Row {
|
|||
Rectangle {
|
||||
// Let the Rectangle size itself based on its content (the Row)
|
||||
visible: root.visible
|
||||
width: row.width + Style.marginS * scaling
|
||||
width: row.width + Style.marginM * 2 * scaling
|
||||
height: Math.round(Style.capsuleHeight * scaling)
|
||||
radius: Math.round(Style.radiusM * scaling)
|
||||
color: Color.mSurfaceVariant
|
||||
|
|
@ -89,9 +86,14 @@ Row {
|
|||
id: titleText
|
||||
|
||||
// For short titles, show full. For long titles, truncate and expand on hover
|
||||
width: mouseArea.containsMouse ? Math.min(fullTitleMetrics.contentWidth + 8,
|
||||
400 * scaling) : Math.min(fullTitleMetrics.contentWidth + 12,
|
||||
200 * scaling)
|
||||
width: {
|
||||
if (mouseArea.containsMouse) {
|
||||
return Math.round(Math.min(fullTitleMetrics.contentWidth, root.maxWidth * scaling))
|
||||
}
|
||||
else {
|
||||
return Math.round(Math.min(fullTitleMetrics.contentWidth, root.minWidth * scaling))
|
||||
}
|
||||
}
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
text: getTitle()
|
||||
font.pointSize: Style.fontSizeS * scaling
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ Row {
|
|||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
readonly property real minWidth: 160
|
||||
readonly property real maxWidth: 400
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Style.marginS * scaling
|
||||
|
|
@ -34,7 +36,7 @@ Row {
|
|||
id: mediaMini
|
||||
|
||||
// Let the Rectangle size itself based on its content (the Row)
|
||||
width: row.width + Style.marginM * scaling * 2
|
||||
width: row.width + Style.marginM * 2 * scaling
|
||||
|
||||
height: Math.round(Style.capsuleHeight * scaling)
|
||||
radius: Math.round(Style.radiusM * scaling)
|
||||
|
|
@ -140,11 +142,15 @@ Row {
|
|||
NText {
|
||||
id: titleText
|
||||
|
||||
// If hovered or just switched window, show up to 400 pixels
|
||||
// If not hovered show up to 120 pixels
|
||||
width: (mouseArea.containsMouse) ? Math.min(fullTitleMetrics.contentWidth,
|
||||
400 * scaling) : Math.min(fullTitleMetrics.contentWidth,
|
||||
120 * scaling)
|
||||
// For short titles, show full. For long titles, truncate and expand on hover
|
||||
width: {
|
||||
if (mouseArea.containsMouse) {
|
||||
return Math.round(Math.min(fullTitleMetrics.contentWidth, root.maxWidth * scaling))
|
||||
}
|
||||
else {
|
||||
return Math.round(Math.min(fullTitleMetrics.contentWidth, root.minWidth * scaling))
|
||||
}
|
||||
}
|
||||
text: getTitle()
|
||||
font.pointSize: Style.fontSizeS * scaling
|
||||
font.weight: Style.fontWeightMedium
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue