[vlc-devel] [PATCH 08/38] qml: fit sliderbar into maininterface boundaries
Fatih Uzunoglu
fuzun54 at outlook.com
Thu Aug 20 19:55:17 CEST 2020
---
.../qt/maininterface/qml/MainInterface.qml | 1 +
modules/gui/qt/player/qml/SliderBar.qml | 28 ++++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/modules/gui/qt/maininterface/qml/MainInterface.qml b/modules/gui/qt/maininterface/qml/MainInterface.qml
index e7ffe949fb..ec7f95616f 100644
--- a/modules/gui/qt/maininterface/qml/MainInterface.qml
+++ b/modules/gui/qt/maininterface/qml/MainInterface.qml
@@ -36,6 +36,7 @@ Rectangle {
property bool _interfaceReady: false
property bool _playlistReady: false
+ property alias mainInterfaceRect: root
Binding {
target: VLCStyle.self
diff --git a/modules/gui/qt/player/qml/SliderBar.qml b/modules/gui/qt/player/qml/SliderBar.qml
index c747b56a9a..feae7e7c90 100644
--- a/modules/gui/qt/player/qml/SliderBar.qml
+++ b/modules/gui/qt/player/qml/SliderBar.qml
@@ -45,8 +45,31 @@ Slider {
property real location: sliderRectMouseArea.mouseX
property real position: location/control.width
+ width: childrenRect.width
+ height: childrenRect.height
+
+ function getX() {
+ var x = location - (timeTooltip.width / 2)
+ var diff = (x + timeTooltip.width) - (VLCStyle.appWidth)
+ var sliderRealX = mainInterfaceRect.mapFromItem(sliderRectMouseArea, sliderRectMouseArea.x, sliderRectMouseArea.y).x
+
+ if (x < -sliderRealX) {
+ arrow.diff = x
+ x = -sliderRealX
+ }
+ else if (diff > 0) {
+ arrow.diff = diff
+ x -= (diff)
+ }
+ else {
+ arrow.diff = 0
+ }
+
+ return x
+ }
+
y: -(childrenRect.height)
- x: location - (timeIndicatorRect.width / 2)
+ x: getX()
visible: control.hovered
Item {
@@ -66,6 +89,9 @@ Slider {
anchors.centerIn: parent
anchors.verticalCenterOffset: -(parent.height / 2)
+ anchors.horizontalCenterOffset: diff
+
+ property int diff: 0
color: VLCStyle.colors.bgAlt
--
2.25.1
More information about the vlc-devel
mailing list