[vlmc-devel] Cursor.qml: Add a triangle to the top of the cursor

Yikai Lu git at videolan.org
Mon Jul 18 15:39:55 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Mon Jul 18 17:04:43 2016 +0900| [f1685cb2ac29685bbd0f38fc6d7c19aca370ea3f] | committer: Yikai Lu

Cursor.qml: Add a triangle to the top of the cursor

> https://code.videolan.org/videolan/vlmc/commit/f1685cb2ac29685bbd0f38fc6d7c19aca370ea3f
---

 src/Gui/timeline/Cursor.qml | 27 ++++++++++++++++++++++-----
 src/Gui/timeline/main.qml   |  1 +
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/Gui/timeline/Cursor.qml b/src/Gui/timeline/Cursor.qml
index 991d23c..3e7a280 100644
--- a/src/Gui/timeline/Cursor.qml
+++ b/src/Gui/timeline/Cursor.qml
@@ -1,7 +1,7 @@
-import QtQuick 2.0
+import QtQuick 2.5
 
 Rectangle {
-    width: 2
+    width: 1
     color: "#c24a00"
     x: ftop( cursorPosition ) + initPosOfCursor
 
@@ -10,8 +10,25 @@ Rectangle {
         x = Qt.binding( function() { return ftop( cursorPosition ) + initPosOfCursor; } );
     }
 
-    function position() {
-        return ptof( x - initPosOfCursor );
+    // Triangle
+    Canvas {
+        id: mycanvas
+        width: 15
+        height: width / 2 * 1.73
+        y: - height
+        x: - width / 2
+
+        onPaint: {
+            var ctx = getContext( "2d" );
+            ctx.fillStyle = Qt.rgba( 0.9, 0.8, 0.25, 1 );
+            ctx.strokeStyle = "transparent";
+            ctx.beginPath();
+            ctx.moveTo( 0, 0 );
+            ctx.lineTo( width, 0 );
+            ctx.lineTo( width / 2, height );
+            ctx.closePath();
+            ctx.fill();
+            ctx.stroke();
+        }
     }
 }
-
diff --git a/src/Gui/timeline/main.qml b/src/Gui/timeline/main.qml
index 014edcc..71b1f3c 100644
--- a/src/Gui/timeline/main.qml
+++ b/src/Gui/timeline/main.qml
@@ -321,6 +321,7 @@ Rectangle {
 
             Cursor {
                 id: cursor
+                y: ruler.height
                 z: 2000
                 height: page.height
                 x: initPosOfCursor



More information about the Vlmc-devel mailing list