bar: fix tooltip shadow cutoff, use fewer Layouts

This commit is contained in:
end-4
2025-09-28 14:03:18 +02:00
parent 0ce4260134
commit de6969f561
5 changed files with 39 additions and 27 deletions
@@ -14,11 +14,12 @@ StyledPopup {
spacing: 4 spacing: 4
// Header // Header
RowLayout { Row {
id: header id: header
spacing: 5 spacing: 5
MaterialSymbol { MaterialSymbol {
anchors.verticalCenter: parent.verticalCenter
fill: 0 fill: 0
font.weight: Font.Medium font.weight: Font.Medium
text: "battery_android_full" text: "battery_android_full"
@@ -27,6 +28,7 @@ StyledPopup {
} }
StyledText { StyledText {
anchors.verticalCenter: parent.verticalCenter
text: "Battery" text: "Battery"
font { font {
weight: Font.Medium weight: Font.Medium
@@ -39,10 +39,11 @@ StyledPopup {
spacing: 4 spacing: 4
// Date + Time row // Date + Time row
RowLayout { Row {
spacing: 5 spacing: 5
MaterialSymbol { MaterialSymbol {
anchors.verticalCenter: parent.verticalCenter
fill: 0 fill: 0
font.weight: Font.Medium font.weight: Font.Medium
text: "calendar_month" text: "calendar_month"
@@ -50,6 +51,7 @@ StyledPopup {
color: Appearance.colors.colOnSurfaceVariant color: Appearance.colors.colOnSurfaceVariant
} }
StyledText { StyledText {
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
color: Appearance.colors.colOnSurfaceVariant color: Appearance.colors.colOnSurfaceVariant
text: `${root.formattedDate}` text: `${root.formattedDate}`
@@ -79,26 +81,26 @@ StyledPopup {
} }
// Tasks // Tasks
ColumnLayout { Column {
spacing: 0 spacing: 0
Layout.fillWidth: true Layout.fillWidth: true
RowLayout { Row {
spacing: 4 spacing: 4
Layout.fillWidth: true
MaterialSymbol { MaterialSymbol {
anchors.verticalCenter: parent.verticalCenter
text: "checklist" text: "checklist"
color: Appearance.colors.colOnSurfaceVariant color: Appearance.colors.colOnSurfaceVariant
font.pixelSize: Appearance.font.pixelSize.large font.pixelSize: Appearance.font.pixelSize.large
} }
StyledText { StyledText {
anchors.verticalCenter: parent.verticalCenter
text: Translation.tr("To Do:") text: Translation.tr("To Do:")
color: Appearance.colors.colOnSurfaceVariant color: Appearance.colors.colOnSurfaceVariant
} }
} }
StyledText { StyledText {
Layout.fillWidth: true
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
wrapMode: Text.Wrap wrapMode: Text.Wrap
color: Appearance.colors.colOnSurfaceVariant color: Appearance.colors.colOnSurfaceVariant
@@ -20,7 +20,6 @@ StyledPopup {
required property string label required property string label
required property string value required property string value
spacing: 4 spacing: 4
Layout.fillWidth: true
MaterialSymbol { MaterialSymbol {
text: resourceItem.icon text: resourceItem.icon
@@ -40,13 +39,14 @@ StyledPopup {
} }
} }
component ResourceHeaderItem: RowLayout { component ResourceHeaderItem: Row {
id: headerItem id: headerItem
required property var icon required property var icon
required property var label required property var label
spacing: 5 spacing: 5
MaterialSymbol { MaterialSymbol {
anchors.verticalCenter: parent.verticalCenter
fill: 0 fill: 0
font.weight: Font.Medium font.weight: Font.Medium
text: headerItem.icon text: headerItem.icon
@@ -55,6 +55,7 @@ StyledPopup {
} }
StyledText { StyledText {
anchors.verticalCenter: parent.verticalCenter
text: headerItem.label text: headerItem.label
font { font {
weight: Font.Medium weight: Font.Medium
@@ -64,19 +65,20 @@ StyledPopup {
} }
} }
RowLayout { Row {
anchors.centerIn: parent anchors.centerIn: parent
spacing: 12 spacing: 12
ColumnLayout { Column {
Layout.alignment: Qt.AlignTop anchors.top: parent.top
spacing: 8 spacing: 8
ResourceHeaderItem { ResourceHeaderItem {
icon: "memory" icon: "memory"
label: "RAM" label: "RAM"
} }
ColumnLayout { Column {
spacing: 4
ResourceItem { ResourceItem {
icon: "clock_loader_60" icon: "clock_loader_60"
label: Translation.tr("Used:") label: Translation.tr("Used:")
@@ -95,16 +97,17 @@ StyledPopup {
} }
} }
ColumnLayout { Column {
visible: ResourceUsage.swapTotal > 0 visible: ResourceUsage.swapTotal > 0
Layout.alignment: Qt.AlignTop anchors.top: parent.top
spacing: 8 spacing: 8
ResourceHeaderItem { ResourceHeaderItem {
icon: "swap_horiz" icon: "swap_horiz"
label: "Swap" label: "Swap"
} }
ColumnLayout { Column {
spacing: 4
ResourceItem { ResourceItem {
icon: "clock_loader_60" icon: "clock_loader_60"
label: Translation.tr("Used:") label: Translation.tr("Used:")
@@ -123,15 +126,16 @@ StyledPopup {
} }
} }
ColumnLayout { Column {
Layout.alignment: Qt.AlignTop anchors.top: parent.top
spacing: 8 spacing: 8
ResourceHeaderItem { ResourceHeaderItem {
icon: "planner_review" icon: "planner_review"
label: "CPU" label: "CPU"
} }
ColumnLayout { Column {
spacing: 4
ResourceItem { ResourceItem {
icon: "bolt" icon: "bolt"
label: Translation.tr("Load:") label: Translation.tr("Load:")
@@ -24,8 +24,8 @@ LazyLoader {
anchors.top: Config.options.bar.vertical || (!Config.options.bar.vertical && !Config.options.bar.bottom) anchors.top: Config.options.bar.vertical || (!Config.options.bar.vertical && !Config.options.bar.bottom)
anchors.bottom: !Config.options.bar.vertical && Config.options.bar.bottom anchors.bottom: !Config.options.bar.vertical && Config.options.bar.bottom
implicitWidth: popupBackground.implicitWidth + Appearance.sizes.hyprlandGapsOut * 2 + root.popupBackgroundMargin implicitWidth: popupBackground.implicitWidth + Appearance.sizes.elevationMargin * 2 + root.popupBackgroundMargin
implicitHeight: popupBackground.implicitHeight + Appearance.sizes.hyprlandGapsOut * 2 + root.popupBackgroundMargin implicitHeight: popupBackground.implicitHeight + Appearance.sizes.elevationMargin * 2 + root.popupBackgroundMargin
mask: Region { mask: Region {
item: popupBackground item: popupBackground
@@ -63,10 +63,10 @@ LazyLoader {
readonly property real margin: 10 readonly property real margin: 10
anchors { anchors {
fill: parent fill: parent
leftMargin: Appearance.sizes.hyprlandGapsOut + root.popupBackgroundMargin * (!popupWindow.anchors.left) leftMargin: Appearance.sizes.elevationMargin + root.popupBackgroundMargin * (!popupWindow.anchors.left)
rightMargin: Appearance.sizes.hyprlandGapsOut + root.popupBackgroundMargin * (!popupWindow.anchors.right) rightMargin: Appearance.sizes.elevationMargin + root.popupBackgroundMargin * (!popupWindow.anchors.right)
topMargin: Appearance.sizes.hyprlandGapsOut + root.popupBackgroundMargin * (!popupWindow.anchors.top) topMargin: Appearance.sizes.elevationMargin + root.popupBackgroundMargin * (!popupWindow.anchors.top)
bottomMargin: Appearance.sizes.hyprlandGapsOut + root.popupBackgroundMargin * (!popupWindow.anchors.bottom) bottomMargin: Appearance.sizes.elevationMargin + root.popupBackgroundMargin * (!popupWindow.anchors.bottom)
} }
implicitWidth: root.contentItem.implicitWidth + margin * 2 implicitWidth: root.contentItem.implicitWidth + margin * 2
implicitHeight: root.contentItem.implicitHeight + margin * 2 implicitHeight: root.contentItem.implicitHeight + margin * 2
@@ -70,12 +70,15 @@ MouseArea {
hoverTarget: root hoverTarget: root
active: GlobalStates.mediaControlsOpen ? false : root.containsMouse active: GlobalStates.mediaControlsOpen ? false : root.containsMouse
ColumnLayout { Column {
anchors.centerIn: parent anchors.centerIn: parent
RowLayout { spacing: 4
spacing: 5
Row {
spacing: 4
MaterialSymbol { MaterialSymbol {
anchors.verticalCenter: parent.verticalCenter
fill: 0 fill: 0
font.weight: Font.Medium font.weight: Font.Medium
text: "music_note" text: "music_note"
@@ -84,6 +87,7 @@ MouseArea {
} }
StyledText { StyledText {
anchors.verticalCenter: parent.verticalCenter
text: "Media" text: "Media"
font { font {
weight: Font.Medium weight: Font.Medium