[vlc-commits] [Git][videolan/vlc][master] qml: use TextMetrics for conditional word wrap in ToolTipExt
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Tue Oct 13 17:24:31 UTC 2026
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
a29a09dd by SK Devane at 2026-10-13T18:58:19+02:00
qml: use TextMetrics for conditional word wrap in ToolTipExt
- - - - -
1 changed file:
- modules/gui/qt/widgets/qml/ToolTipExt.qml
Changes:
=====================================
modules/gui/qt/widgets/qml/ToolTipExt.qml
=====================================
@@ -18,6 +18,7 @@
import QtQuick
import QtQuick.Templates as T
+import QtQuick.Window
import VLC.MainInterface
import VLC.Style
@@ -77,8 +78,7 @@ T.ToolTip {
text: control.text
font: control.font
- wrapMode: Text.WordWrap
-
+ wrapMode: textMetrics.width > maxContentWidth ? Text.WordWrap : Text.NoWrap
color: theme.fg.primary
property QtWindow _lastWindowForNoRedirectionSurface
@@ -96,6 +96,25 @@ T.ToolTip {
})
}
}
+
+ readonly property real maxContentWidth: (control.popupType === 1 /* Popup.Window */)
+ ? Screen.desktopAvailableWidth
+ : Window.width
+
+ TextMetrics {
+ id: textMetrics
+
+ font: contentText.font
+ text: {
+ const lines = contentText.text.split("\n")
+ let longestLine = ""
+ for (let i in lines) {
+ if (lines[i].length > longestLine.length)
+ longestLine = lines[i]
+ }
+ return longestLine
+ }
+ }
}
background: Rectangle {
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/a29a09dd2048da3c5d1bec5170f1307216a98ed1
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/a29a09dd2048da3c5d1bec5170f1307216a98ed1
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list