From 86127660fe172e37f34a70623e428f80a7f1714e Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Fri, 3 Oct 2025 23:27:07 -0400 Subject: [PATCH] Tooltip: different approach to get the current screen. --- Modules/Bar/Extras/BarPill.qml | 4 --- Modules/Bar/Extras/BarPillHorizontal.qml | 4 +-- Modules/Bar/Extras/BarPillVertical.qml | 5 +-- Modules/Bar/Widgets/ActiveWindow.qml | 2 +- Modules/Bar/Widgets/Battery.qml | 1 - Modules/Bar/Widgets/Brightness.qml | 1 - Modules/Bar/Widgets/Clock.qml | 2 +- Modules/Bar/Widgets/CustomButton.qml | 1 - Modules/Bar/Widgets/KeyboardLayout.qml | 1 - Modules/Bar/Widgets/MediaMini.qml | 2 +- Modules/Bar/Widgets/Microphone.qml | 1 - Modules/Bar/Widgets/Taskbar.qml | 2 +- Modules/Bar/Widgets/Tray.qml | 2 +- Modules/Bar/Widgets/Volume.qml | 1 - Modules/ControlCenter/Cards/MediaCard.qml | 5 --- .../ControlCenter/Cards/PowerProfilesCard.qml | 4 --- Modules/ControlCenter/Cards/ProfileCard.qml | 4 --- .../ControlCenter/Cards/SystemMonitorCard.qml | 2 -- Modules/ControlCenter/Cards/UtilitiesCard.qml | 4 --- Modules/ControlCenter/Cards/WeatherCard.qml | 1 - Modules/ControlCenter/ControlCenterPanel.qml | 6 ---- Modules/Dock/Dock.qml | 2 +- .../Notification/NotificationHistoryPanel.qml | 3 -- Modules/SessionMenu/SessionMenu.qml | 1 - Modules/Settings/Bar/BarSectionEditor.qml | 1 - Modules/Settings/Tabs/AboutTab.qml | 3 +- Modules/Settings/Tabs/ColorSchemeTab.qml | 4 +-- Modules/Settings/Tabs/DockTab.qml | 1 + Modules/Settings/Tabs/WallpaperTab.qml | 3 +- Modules/Tooltip/Tooltip.qml | 31 +++++++------------ Services/TooltipService.qml | 6 ++-- Widgets/NButton.qml | 2 +- Widgets/NIconButton.qml | 3 +- 33 files changed, 32 insertions(+), 83 deletions(-) diff --git a/Modules/Bar/Extras/BarPill.qml b/Modules/Bar/Extras/BarPill.qml index 03a5941d..ff4ae3bb 100644 --- a/Modules/Bar/Extras/BarPill.qml +++ b/Modules/Bar/Extras/BarPill.qml @@ -8,8 +8,6 @@ import qs.Widgets Item { id: root - property ShellScreen screen - property string icon: "" property string text: "" property string suffix: "" @@ -46,7 +44,6 @@ Item { Component { id: verticalPillComponent BarPillVertical { - screen: root.screen icon: root.icon text: root.text suffix: root.suffix @@ -72,7 +69,6 @@ Item { Component { id: horizontalPillComponent BarPillHorizontal { - screen: root.screen icon: root.icon text: root.text suffix: root.suffix diff --git a/Modules/Bar/Extras/BarPillHorizontal.qml b/Modules/Bar/Extras/BarPillHorizontal.qml index 2691a7b6..a7da0d1d 100644 --- a/Modules/Bar/Extras/BarPillHorizontal.qml +++ b/Modules/Bar/Extras/BarPillHorizontal.qml @@ -59,8 +59,6 @@ Item { Rectangle { id: pill - property ShellScreen screen: root.screen - width: revealed ? pillMaxWidth : 1 height: pillHeight @@ -225,7 +223,7 @@ Item { onEntered: { hovered = true root.entered() - TooltipService.show(pill, root.tooltipText, BarService.getTooltipDirection(), Style.tooltipDelayLong) + TooltipService.show(Screen, pill, root.tooltipText, BarService.getTooltipDirection(), Style.tooltipDelayLong) if (disableOpen || forceClose) { return } diff --git a/Modules/Bar/Extras/BarPillVertical.qml b/Modules/Bar/Extras/BarPillVertical.qml index ef6dff13..f11b06e6 100644 --- a/Modules/Bar/Extras/BarPillVertical.qml +++ b/Modules/Bar/Extras/BarPillVertical.qml @@ -8,7 +8,6 @@ import qs.Widgets Item { id: root - property ShellScreen screen property string icon: "" property string text: "" property string suffix: "" @@ -70,8 +69,6 @@ Item { Rectangle { id: pill - property ShellScreen screen: root.screen - width: revealed ? maxPillWidth : 1 height: revealed ? maxPillHeight : 1 @@ -265,7 +262,7 @@ Item { onEntered: { hovered = true root.entered() - TooltipService.show(pill, root.tooltipText, BarService.getTooltipDirection(), Style.tooltipDelayLong) + TooltipService.show(Screen, pill, root.tooltipText, BarService.getTooltipDirection(), Style.tooltipDelayLong) if (disableOpen || forceClose) { return } diff --git a/Modules/Bar/Widgets/ActiveWindow.qml b/Modules/Bar/Widgets/ActiveWindow.qml index 128fab66..5b1272dd 100644 --- a/Modules/Bar/Widgets/ActiveWindow.qml +++ b/Modules/Bar/Widgets/ActiveWindow.qml @@ -329,7 +329,7 @@ Item { acceptedButtons: Qt.LeftButton onEntered: { if ((windowTitle !== "") && (barPosition === "left" || barPosition === "right") || (scrollingMode === "never")) { - TooltipService.show(root, windowTitle, BarService.getTooltipDirection()) + TooltipService.show(Screen, root, windowTitle, BarService.getTooltipDirection()) } } onExited: { diff --git a/Modules/Bar/Widgets/Battery.qml b/Modules/Bar/Widgets/Battery.qml index 79b987e9..336ee925 100644 --- a/Modules/Bar/Widgets/Battery.qml +++ b/Modules/Bar/Widgets/Battery.qml @@ -87,7 +87,6 @@ Item { BarPill { id: pill - screen: root.screen compact: (Settings.data.bar.density === "compact") rightOpen: BarService.getPillDirection(root) icon: testMode ? BatteryService.getIcon(testPercent, testCharging, true) : BatteryService.getIcon(percent, charging, isReady) diff --git a/Modules/Bar/Widgets/Brightness.qml b/Modules/Bar/Widgets/Brightness.qml index 35ca2666..652660c0 100644 --- a/Modules/Bar/Widgets/Brightness.qml +++ b/Modules/Bar/Widgets/Brightness.qml @@ -77,7 +77,6 @@ Item { BarPill { id: pill - screen: root.screen compact: (Settings.data.bar.density === "compact") rightOpen: BarService.getPillDirection(root) icon: getIcon() diff --git a/Modules/Bar/Widgets/Clock.qml b/Modules/Bar/Widgets/Clock.qml index 0167d83f..26ae5762 100644 --- a/Modules/Bar/Widgets/Clock.qml +++ b/Modules/Bar/Widgets/Clock.qml @@ -115,7 +115,7 @@ Rectangle { hoverEnabled: true onEntered: { if (!PanelService.getPanel("calendarPanel")?.active) { - TooltipService.show(root, I18n.tr("clock.tooltip"), BarService.getTooltipDirection()) + TooltipService.show(Screen, root, I18n.tr("clock.tooltip"), BarService.getTooltipDirection()) } } onExited: { diff --git a/Modules/Bar/Widgets/CustomButton.qml b/Modules/Bar/Widgets/CustomButton.qml index ce144650..3973b4cd 100644 --- a/Modules/Bar/Widgets/CustomButton.qml +++ b/Modules/Bar/Widgets/CustomButton.qml @@ -47,7 +47,6 @@ Item { BarPill { id: pill - screen: root.screen rightOpen: BarService.getPillDirection(root) icon: customIcon text: _dynamicText diff --git a/Modules/Bar/Widgets/KeyboardLayout.qml b/Modules/Bar/Widgets/KeyboardLayout.qml index a85521b4..ec83b71e 100644 --- a/Modules/Bar/Widgets/KeyboardLayout.qml +++ b/Modules/Bar/Widgets/KeyboardLayout.qml @@ -42,7 +42,6 @@ Item { BarPill { id: pill - screen: root.screen anchors.verticalCenter: parent.verticalCenter compact: (Settings.data.bar.density === "compact") rightOpen: BarService.getPillDirection(root) diff --git a/Modules/Bar/Widgets/MediaMini.qml b/Modules/Bar/Widgets/MediaMini.qml index 75fdfed9..8e7bafae 100644 --- a/Modules/Bar/Widgets/MediaMini.qml +++ b/Modules/Bar/Widgets/MediaMini.qml @@ -390,7 +390,7 @@ Item { onEntered: { var textToShow = hasActivePlayer ? tooltipText : placeholderText if ((textToShow !== "") && (barPosition === "left" || barPosition === "right") || (scrollingMode === "never")) { - TooltipService.show(root, textToShow, BarService.getTooltipDirection()) + TooltipService.show(Screen, root, textToShow, BarService.getTooltipDirection()) } } onExited: { diff --git a/Modules/Bar/Widgets/Microphone.qml b/Modules/Bar/Widgets/Microphone.qml index d1feb135..d0d35727 100644 --- a/Modules/Bar/Widgets/Microphone.qml +++ b/Modules/Bar/Widgets/Microphone.qml @@ -90,7 +90,6 @@ Item { BarPill { id: pill - screen: root.screen rightOpen: BarService.getPillDirection(root) icon: getIcon() compact: (Settings.data.bar.density === "compact") diff --git a/Modules/Bar/Widgets/Taskbar.qml b/Modules/Bar/Widgets/Taskbar.qml index c0e54585..9a0b356e 100644 --- a/Modules/Bar/Widgets/Taskbar.qml +++ b/Modules/Bar/Widgets/Taskbar.qml @@ -117,7 +117,7 @@ Rectangle { } } } - onEntered: TooltipService.show(taskbarItem, taskbarItem.modelData.title || taskbarItem.modelData.appId || "Unknown app.", BarService.getTooltipDirection()) + onEntered: TooltipService.show(Screen, taskbarItem, taskbarItem.modelData.title || taskbarItem.modelData.appId || "Unknown app.", BarService.getTooltipDirection()) onExited: TooltipService.hide() } } diff --git a/Modules/Bar/Widgets/Tray.qml b/Modules/Bar/Widgets/Tray.qml index 741f0e20..b93c4b7a 100644 --- a/Modules/Bar/Widgets/Tray.qml +++ b/Modules/Bar/Widgets/Tray.qml @@ -140,7 +140,7 @@ Rectangle { } onEntered: { trayPanel.close() - TooltipService.show(trayIcon, modelData.tooltipTitle || modelData.name || modelData.id || "Tray Item", BarService.getTooltipDirection()) + TooltipService.show(Screen, trayIcon, modelData.tooltipTitle || modelData.name || modelData.id || "Tray Item", BarService.getTooltipDirection()) } onExited: TooltipService.hide() } diff --git a/Modules/Bar/Widgets/Volume.qml b/Modules/Bar/Widgets/Volume.qml index edea87be..775a31d6 100644 --- a/Modules/Bar/Widgets/Volume.qml +++ b/Modules/Bar/Widgets/Volume.qml @@ -75,7 +75,6 @@ Item { BarPill { id: pill - screen: root.screen compact: (Settings.data.bar.density === "compact") rightOpen: BarService.getPillDirection(root) icon: getIcon() diff --git a/Modules/ControlCenter/Cards/MediaCard.qml b/Modules/ControlCenter/Cards/MediaCard.qml index af0cf3c7..be99ef13 100644 --- a/Modules/ControlCenter/Cards/MediaCard.qml +++ b/Modules/ControlCenter/Cards/MediaCard.qml @@ -10,8 +10,6 @@ import qs.Widgets NBox { id: root - property ShellScreen screen - ColumnLayout { anchors.fill: parent anchors.margins: Style.marginL * scaling @@ -282,7 +280,6 @@ NBox { // Previous button NIconButton { icon: "media-prev" - screen: root.screen tooltipText: I18n.tr("tooltips.previous-media") visible: MediaService.canGoPrevious onClicked: MediaService.canGoPrevious ? MediaService.previous() : {} @@ -291,7 +288,6 @@ NBox { // Play/Pause button NIconButton { icon: MediaService.isPlaying ? "media-pause" : "media-play" - screen: root.screen tooltipText: MediaService.isPlaying ? I18n.tr("tooltips.pause") : I18n.tr("tooltips.play") visible: (MediaService.canPlay || MediaService.canPause) onClicked: (MediaService.canPlay || MediaService.canPause) ? MediaService.playPause() : {} @@ -300,7 +296,6 @@ NBox { // Next button NIconButton { icon: "media-next" - screen: root.screen tooltipText: I18n.tr("tooltips.next-media") visible: MediaService.canGoNext onClicked: MediaService.canGoNext ? MediaService.next() : {} diff --git a/Modules/ControlCenter/Cards/PowerProfilesCard.qml b/Modules/ControlCenter/Cards/PowerProfilesCard.qml index dba4573b..d93b26ba 100644 --- a/Modules/ControlCenter/Cards/PowerProfilesCard.qml +++ b/Modules/ControlCenter/Cards/PowerProfilesCard.qml @@ -10,7 +10,6 @@ import qs.Widgets // Power Profiles: performance, balanced, eco NBox { - property ShellScreen screen property real spacing: 0 // Centralized service @@ -27,7 +26,6 @@ NBox { // Performance NIconButton { icon: PowerProfileService.getIcon(PowerProfile.Performance) - screen: root.screen tooltipText: I18n.tr("tooltips.set-power-profile", { "profile": PowerProfileService.getName(PowerProfile.Performance) }) @@ -40,7 +38,6 @@ NBox { // Balanced NIconButton { icon: PowerProfileService.getIcon(PowerProfile.Balanced) - screen: root.screen tooltipText: I18n.tr("tooltips.set-power-profile", { "profile": PowerProfileService.getName(PowerProfile.Balanced) }) @@ -53,7 +50,6 @@ NBox { // Eco NIconButton { icon: PowerProfileService.getIcon(PowerProfile.PowerSaver) - screen: root.screen tooltipText: I18n.tr("tooltips.set-power-profile", { "profile": PowerProfileService.getName(PowerProfile.PowerSaver) }) diff --git a/Modules/ControlCenter/Cards/ProfileCard.qml b/Modules/ControlCenter/Cards/ProfileCard.qml index c20c7d3e..ec9b4527 100644 --- a/Modules/ControlCenter/Cards/ProfileCard.qml +++ b/Modules/ControlCenter/Cards/ProfileCard.qml @@ -14,7 +14,6 @@ import qs.Widgets NBox { id: root - property ShellScreen screen property string uptimeText: "--" RowLayout { @@ -59,7 +58,6 @@ NBox { } NIconButton { icon: "settings" - screen: root.screen tooltipText: I18n.tr("tooltips.open-settings") onClicked: { settingsPanel.requestedTab = SettingsPanel.Tab.General @@ -69,7 +67,6 @@ NBox { NIconButton { icon: "power" - screen: root.screen tooltipText: I18n.tr("tooltips.session-menu") onClicked: { sessionMenuPanel.open() @@ -79,7 +76,6 @@ NBox { NIconButton { icon: "close" - screen: root.screen tooltipText: I18n.tr("tooltips.close") onClicked: { controlCenterPanel.close() diff --git a/Modules/ControlCenter/Cards/SystemMonitorCard.qml b/Modules/ControlCenter/Cards/SystemMonitorCard.qml index a7622af1..67ca2c68 100644 --- a/Modules/ControlCenter/Cards/SystemMonitorCard.qml +++ b/Modules/ControlCenter/Cards/SystemMonitorCard.qml @@ -9,8 +9,6 @@ import qs.Widgets NBox { id: root - property ShellScreen screen - ColumnLayout { id: content anchors.left: parent.left diff --git a/Modules/ControlCenter/Cards/UtilitiesCard.qml b/Modules/ControlCenter/Cards/UtilitiesCard.qml index d1215905..decd9659 100644 --- a/Modules/ControlCenter/Cards/UtilitiesCard.qml +++ b/Modules/ControlCenter/Cards/UtilitiesCard.qml @@ -10,7 +10,6 @@ import qs.Widgets // Utilities: record & wallpaper NBox { - property ShellScreen screen property real spacing: 0 RowLayout { @@ -24,7 +23,6 @@ NBox { // Screen Recorder NIconButton { icon: "camera-video" - screen: root.screen enabled: ScreenRecorderService.isAvailable tooltipText: ScreenRecorderService.isAvailable ? (ScreenRecorderService.isRecording ? I18n.tr("tooltips.stop-screen-recording") : I18n.tr("tooltips.start-screen-recording")) : I18n.tr("tooltips.screen-recorder-not-installed") colorBg: ScreenRecorderService.isRecording ? Color.mPrimary : Color.mSurfaceVariant @@ -44,7 +42,6 @@ NBox { // Idle Inhibitor NIconButton { icon: IdleInhibitorService.isInhibited ? "keep-awake-on" : "keep-awake-off" - screen: root.screen tooltipText: IdleInhibitorService.isInhibited ? I18n.tr("tooltips.disable-keep-awake") : I18n.tr("tooltips.enable-keep-awake") colorBg: IdleInhibitorService.isInhibited ? Color.mPrimary : Color.mSurfaceVariant colorFg: IdleInhibitorService.isInhibited ? Color.mOnPrimary : Color.mPrimary @@ -57,7 +54,6 @@ NBox { NIconButton { visible: Settings.data.wallpaper.enabled icon: "wallpaper-selector" - screen: root.screen tooltipText: I18n.tr("tooltips.wallpaper-selector") onClicked: PanelService.getPanel("wallpaperPanel")?.toggle(this) onRightClicked: WallpaperService.setRandomWallpaper() diff --git a/Modules/ControlCenter/Cards/WeatherCard.qml b/Modules/ControlCenter/Cards/WeatherCard.qml index 4a780fa4..778d277b 100644 --- a/Modules/ControlCenter/Cards/WeatherCard.qml +++ b/Modules/ControlCenter/Cards/WeatherCard.qml @@ -9,7 +9,6 @@ import qs.Widgets NBox { id: root - property ShellScreen screen readonly property bool weatherReady: (LocationService.data.weather !== null) ColumnLayout { diff --git a/Modules/ControlCenter/ControlCenterPanel.qml b/Modules/ControlCenter/ControlCenterPanel.qml index 3e926671..de1e7753 100644 --- a/Modules/ControlCenter/ControlCenterPanel.qml +++ b/Modules/ControlCenter/ControlCenterPanel.qml @@ -29,13 +29,11 @@ NPanel { // Cards (consistent inter-card spacing via ColumnLayout spacing) ProfileCard { - screen: root.screen Layout.fillWidth: true Layout.preferredHeight: Math.max(64 * scaling) } WeatherCard { - screen: root.screen Layout.fillWidth: true Layout.preferredHeight: Math.max(220 * scaling) } @@ -48,14 +46,12 @@ NPanel { // Media card MediaCard { - screen: root.screen Layout.fillWidth: true Layout.fillHeight: true } // System monitors combined in one card SystemMonitorCard { - screen: root.screen Layout.preferredWidth: Style.baseWidgetSize * 2.625 * scaling Layout.fillHeight: true } @@ -69,7 +65,6 @@ NPanel { // Power Profiles switcher PowerProfilesCard { - screen: root.screen Layout.fillWidth: true Layout.fillHeight: true spacing: content.cardSpacing @@ -77,7 +72,6 @@ NPanel { // Utilities buttons UtilitiesCard { - screen: root.screen Layout.fillWidth: true Layout.fillHeight: true spacing: content.cardSpacing diff --git a/Modules/Dock/Dock.qml b/Modules/Dock/Dock.qml index e8c3d21e..53fd7142 100644 --- a/Modules/Dock/Dock.qml +++ b/Modules/Dock/Dock.qml @@ -480,7 +480,7 @@ Variants { anyAppHovered = true const appName = appButton.appTitle || appButton.appId || "Unknown" const tooltipText = appName.length > 40 ? appName.substring(0, 37) + "..." : appName - TooltipService.show(appButton, tooltipText, "top") + TooltipService.show(Screen, appButton, tooltipText, "top") if (autoHide) { showTimer.stop() hideTimer.stop() diff --git a/Modules/Notification/NotificationHistoryPanel.qml b/Modules/Notification/NotificationHistoryPanel.qml index 37771044..c8df7b0d 100644 --- a/Modules/Notification/NotificationHistoryPanel.qml +++ b/Modules/Notification/NotificationHistoryPanel.qml @@ -46,7 +46,6 @@ NPanel { NIconButton { icon: Settings.data.notifications.doNotDisturb ? "bell-off" : "bell" - screen: root.screen tooltipText: Settings.data.notifications.doNotDisturb ? I18n.tr("tooltips.do-not-disturb-enabled") : I18n.tr("tooltips.do-not-disturb-disabled") baseSize: Style.baseWidgetSize * 0.8 onClicked: Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb @@ -54,7 +53,6 @@ NPanel { NIconButton { icon: "trash" - screen: root.screen tooltipText: I18n.tr("tooltips.clear-history") baseSize: Style.baseWidgetSize * 0.8 onClicked: { @@ -66,7 +64,6 @@ NPanel { NIconButton { icon: "close" - screen: root.screen tooltipText: I18n.tr("tooltips.close") baseSize: Style.baseWidgetSize * 0.8 onClicked: root.close() diff --git a/Modules/SessionMenu/SessionMenu.qml b/Modules/SessionMenu/SessionMenu.qml index 346bffc2..039c2c98 100644 --- a/Modules/SessionMenu/SessionMenu.qml +++ b/Modules/SessionMenu/SessionMenu.qml @@ -288,7 +288,6 @@ NPanel { NIconButton { icon: timerActive ? "stop" : "close" - screen: root.screen tooltipText: timerActive ? I18n.tr("tooltips.cancel-timer") : I18n.tr("tooltips.close") Layout.alignment: Qt.AlignVCenter colorBg: timerActive ? Qt.alpha(Color.mError, 0.08) : Color.transparent diff --git a/Modules/Settings/Bar/BarSectionEditor.qml b/Modules/Settings/Bar/BarSectionEditor.qml index ba587246..a36a1b17 100644 --- a/Modules/Settings/Bar/BarSectionEditor.qml +++ b/Modules/Settings/Bar/BarSectionEditor.qml @@ -106,7 +106,6 @@ NBox { NIconButton { icon: "add" - colorBg: Color.mPrimary colorFg: Color.mOnPrimary colorBgHover: Color.mSecondary diff --git a/Modules/Settings/Tabs/AboutTab.qml b/Modules/Settings/Tabs/AboutTab.qml index fb2eaaff..30e59f21 100644 --- a/Modules/Settings/Tabs/AboutTab.qml +++ b/Modules/Settings/Tabs/AboutTab.qml @@ -10,12 +10,13 @@ import qs.Widgets ColumnLayout { id: root - spacing: Style.marginL * scaling property string latestVersion: GitHubService.latestVersion property string currentVersion: UpdateService.currentVersion property var contributors: GitHubService.contributors + spacing: Style.marginL * scaling + NHeader { label: I18n.tr("settings.about.noctalia.section.label") description: I18n.tr("settings.about.noctalia.section.description") diff --git a/Modules/Settings/Tabs/ColorSchemeTab.qml b/Modules/Settings/Tabs/ColorSchemeTab.qml index de7add83..cf58414f 100644 --- a/Modules/Settings/Tabs/ColorSchemeTab.qml +++ b/Modules/Settings/Tabs/ColorSchemeTab.qml @@ -1,7 +1,6 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts -import QtQuick.Shapes import Quickshell.Io import qs.Commons import qs.Services @@ -9,7 +8,6 @@ import qs.Widgets ColumnLayout { id: root - spacing: Style.marginL * scaling // Cache for scheme JSON (can be flat or {dark, light}) property var schemeColorsCache: ({}) @@ -18,6 +16,8 @@ ColumnLayout { property real cardScaleLow: 0.95 property real cardScaleHigh: 1.0 + spacing: Style.marginL * scaling + // Helper function to extract scheme name from path function extractSchemeName(schemePath) { var pathParts = schemePath.split("/") diff --git a/Modules/Settings/Tabs/DockTab.qml b/Modules/Settings/Tabs/DockTab.qml index 55af3a6a..b13e69f5 100644 --- a/Modules/Settings/Tabs/DockTab.qml +++ b/Modules/Settings/Tabs/DockTab.qml @@ -8,6 +8,7 @@ import qs.Widgets ColumnLayout { id: root + spacing: Style.marginL * scaling // Helper functions to update arrays immutably diff --git a/Modules/Settings/Tabs/WallpaperTab.qml b/Modules/Settings/Tabs/WallpaperTab.qml index ad1ee6b1..d8a2bc56 100644 --- a/Modules/Settings/Tabs/WallpaperTab.qml +++ b/Modules/Settings/Tabs/WallpaperTab.qml @@ -9,10 +9,11 @@ import qs.Widgets ColumnLayout { id: root - spacing: Style.marginL * scaling property string specificFolderMonitorName: "" + spacing: Style.marginL * scaling + NHeader { label: I18n.tr("settings.wallpaper.settings.section.label") description: I18n.tr("settings.wallpaper.settings.section.description") diff --git a/Modules/Tooltip/Tooltip.qml b/Modules/Tooltip/Tooltip.qml index 64e98e7e..8e8e532a 100644 --- a/Modules/Tooltip/Tooltip.qml +++ b/Modules/Tooltip/Tooltip.qml @@ -8,6 +8,10 @@ import qs.Widgets PopupWindow { id: root + property real scaling: 1.0 + property int screenWidth: 0 + property int screenHeight: 0 + property string text: "" property string direction: "auto" // "auto", "left", "right", "top", "bottom" property int margin: Style.marginXS // distance from target @@ -15,7 +19,7 @@ PopupWindow { property int delay: 0 property int hideDelay: 0 property int maxWidth: 320 - property real scaling: 1.0 + property int animationDuration: Style.animationFast property real animationScale: 0.85 @@ -106,11 +110,15 @@ PopupWindow { } // Function to show tooltip - function show(target, tipText, customDirection, showDelay) { - if (!target || !tipText || tipText === "") + function show(screen, target, tipText, customDirection, showDelay) { + if (!screen || !target || !tipText || tipText === "") return - delay = showDelay + root.scaling = ScalingService.getScreenScaleByName(screen.name) + root.screenWidth = screen.width + root.screenHeight = screen.height + + root.delay = showDelay // Stop any running timers and animations hideTimer.stop() @@ -144,21 +152,6 @@ PopupWindow { return } - // Get screen dimensions - try multiple methods - var screenWidth = Screen.width - var screenHeight = Screen.height - - // Try to get screen from target item - if (targetItem) { - if (targetItem.screen) { - screenWidth = targetItem.screen.width - screenHeight = targetItem.screen.height - scaling = ScalingService.getScreenScale(targetItem.screen) - } else { - Logger.warn("Tooltip", "Could not get screen scale for targetItem:", targetItem) - } - } - // Calculate tooltip dimensions const tipWidth = Math.min(tooltipText.implicitWidth + (padding * 2 * scaling), maxWidth * scaling) root.implicitWidth = tipWidth diff --git a/Services/TooltipService.qml b/Services/TooltipService.qml index 99a42c80..b1ea68b2 100644 --- a/Services/TooltipService.qml +++ b/Services/TooltipService.qml @@ -15,9 +15,9 @@ Singleton { Tooltip {} } - function show(target, text, direction, delay) { + function show(screen, target, text, direction, delay) { // Don't create if no text - if (!target || !text) { + if (!screen || !target || !text) { Logger.log("Tooltip", "No target or text") return } @@ -74,7 +74,7 @@ Singleton { }) // Show the tooltip - newTooltip.show(target, text, direction || "auto", delay || Style.tooltipDelay) + newTooltip.show(screen, target, text, direction || "auto", delay || Style.tooltipDelay) return newTooltip } else { diff --git a/Widgets/NButton.qml b/Widgets/NButton.qml index 93390ce9..6ce1c75b 100644 --- a/Widgets/NButton.qml +++ b/Widgets/NButton.qml @@ -138,7 +138,7 @@ Rectangle { onEntered: { root.hovered = true if (tooltipText) { - TooltipService.show(root, root.tooltipText) + TooltipService.show(Screen, root, root.tooltipText) } } onExited: { diff --git a/Widgets/NIconButton.qml b/Widgets/NIconButton.qml index daf4c473..e2d0d0fa 100644 --- a/Widgets/NIconButton.qml +++ b/Widgets/NIconButton.qml @@ -7,7 +7,6 @@ import qs.Services Rectangle { id: root - property ShellScreen screen property real baseSize: Style.baseWidgetSize property string icon @@ -74,7 +73,7 @@ Rectangle { onEntered: { hovering = root.enabled ? true : false if (tooltipText) { - TooltipService.show(parent, tooltipText, tooltipDirection) + TooltipService.show(Screen, parent, tooltipText, tooltipDirection) } root.entered() }