[vlc-commits] qml: fix scaling in PointingTooltip
Fatih Uzunoglu
git at videolan.org
Wed Feb 17 09:31:57 UTC 2021
vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Fri Feb 12 00:23:43 2021 +0300| [7c963ccf8b6e65675536b66fd8e0246b33bcff7b] | committer: Pierre Lamot
qml: fix scaling in PointingTooltip
Signed-off-by: Pierre Lamot <pierre at videolabs.io>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7c963ccf8b6e65675536b66fd8e0246b33bcff7b
---
modules/gui/qt/widgets/qml/PointingTooltip.qml | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/modules/gui/qt/widgets/qml/PointingTooltip.qml b/modules/gui/qt/widgets/qml/PointingTooltip.qml
index 8907175f88..0042826cb7 100644
--- a/modules/gui/qt/widgets/qml/PointingTooltip.qml
+++ b/modules/gui/qt/widgets/qml/PointingTooltip.qml
@@ -27,7 +27,7 @@ Item {
// set parentWindow if you want to let tooltip not exceed window boundaries
// if it is not set, tooltip will use mouseArea as the bounding rect.
// Note that for now it only works with x axis.
- property var parentWindow: undefined
+ property var parentWindow: g_root
property var mouseArea: undefined
@@ -48,7 +48,6 @@ Item {
function getX() {
var x = xPos - (pointingTooltip.width / 2)
var diff = (x + pointingTooltip.width)
-
var windowMappedX = !!parentWindow ? parentWindow.mapFromItem(mouseArea, mouseArea.x, mouseArea.y).x : undefined
var sliderRealX = 0
@@ -56,9 +55,9 @@ Item {
if (!!parentWindow) {
diff -= parentWindow.width - windowMappedX
sliderRealX = windowMappedX
- }
- else
+ } else {
diff -= mouseArea.width
+ }
if (x < -sliderRealX) {
if (!!parentWindow)
@@ -66,12 +65,10 @@ Item {
else
arrow.diff = x
x = -sliderRealX
- }
- else if (diff > 0) {
+ } else if (diff > 0) {
arrow.diff = diff
x -= (diff)
- }
- else {
+ } else {
arrow.diff = 0
}
@@ -137,12 +134,14 @@ Item {
anchors.fill: parent
text: timeMetrics.text
color: colors.text
+ font: timeMetrics.font
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
TextMetrics {
id: timeMetrics
+ font.pixelSize: VLCStyle.fontSize_normal
}
}
}
More information about the vlc-commits
mailing list