https://bugs.kde.org/show_bug.cgi?id=503693

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |junior-jobs
             Status|REPORTED                    |NEEDSINFO
                 CC|                            |[email protected]
         Resolution|---                         |WAITINGFORINFO

--- Comment #1 from [email protected] ---
Here's a Claude suggestion on how to implement this:

diff --git a/src/timeline2/view/qml/timelineplayhead.h
b/src/timeline2/view/qml/timelineplayhead.h
index e0147f2..f3bde45 100644
--- a/src/timeline2/view/qml/timelineplayhead.h
+++ b/src/timeline2/view/qml/timelineplayhead.h
@@ -12,6 +12,8 @@

 public:
     TimelinePlayhead(QQuickItem *parent = nullptr);
+    
+    void snapToClosestPoint(int currentPosition);
     void paint(QPainter *painter) override;

 Q_SIGNALS:
diff --git a/src/timeline2/view/qml/timelineplayhead.cpp
b/src/timeline2/view/qml/timelineplayhead.cpp
index 00d3d9d..328b5bc 100644
--- a/src/timeline2/view/qml/timelineplayhead.cpp
+++ b/src/timeline2/view/qml/timelineplayhead.cpp
@@ -9,6 +9,15 @@

 TimelinePlayhead::TimelinePlayhead(QQuickItem *parent)
     : QQuickPaintedItem(parent)
+{
+    // Initialize snapping system if required
 }

+void TimelinePlayhead::snapToClosestPoint(int currentPosition) {
+    int snappedPosition = SnapModel::getClosestPoint(currentPosition);
+    // Move the playhead to the snapped position
+    setCursorPosition(snappedPosition);
+}
+
 void TimelinePlayhead::paint(QPainter *painter)
 {
diff --git a/src/monitor/monitorproxy.h b/src/monitor/monitorproxy.h
index d1227bc..72634de 100644
--- a/src/monitor/monitorproxy.h
+++ b/src/monitor/monitorproxy.h
@@ -12,6 +12,7 @@
     void setCursorPosition(int pos);
     void setJobsProgress(const ObjectId &owner, const QStringList &jobNames,
const QList<int> &jobProgress, const QStringList &jobUuids);
     void addSnap(int);
+    void snapCursorToElements(int currentPos);
     void removeSnap(int);
diff --git a/src/monitor/monitorproxy.cpp b/src/monitor/monitorproxy.cpp
index 5a9f45b..91df1da 100644
--- a/src/monitor/monitorproxy.cpp
+++ b/src/monitor/monitorproxy.cpp
@@ -16,6 +16,19 @@
 }

 void MonitorProxy::addSnap(int pos) {
+    SnapModel::addPoint(pos); // Register a new snap point
 }
+
+void MonitorProxy::snapCursorToElements(int currentPos) {
+    if (KdenliveSettings::snaptopoints()) { // Only snap when the feature is
enabled
+        int snapPos = SnapModel::getClosestPoint(currentPos);
+        if (snapPos != -1) {
+            setCursorPosition(snapPos);
+        }
+    }
+}
+

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to