]> git.sesse.net Git - kdenlive/blobdiff - src/customruler.cpp
Clean up timecode handling, improves:
[kdenlive] / src / customruler.cpp
index 4c02217a83fb59e355b2eadabfe4e80b9ecfd512..fd9786e645a36dfd5fb1b26847ec52db8d201a41 100644 (file)
@@ -81,6 +81,14 @@ CustomRuler::CustomRuler(Timecode tc, CustomTrackView *parent) :
     setMinimumHeight(20);
 }
 
+void CustomRuler::updateProjectFps(Timecode t)
+{
+    m_timecode = t;
+    mediumMarkDistance = FRAME_SIZE * m_timecode.fps();
+    bigMarkDistance = FRAME_SIZE * m_timecode.fps() * 60;
+    update();
+}
+
 void CustomRuler::slotEditGuide()
 {
     m_view->slotEditGuide(m_clickedGuide);
@@ -111,6 +119,7 @@ void CustomRuler::mousePressEvent(QMouseEvent * event)
         m_contextMenu->exec(event->globalPos());
         return;
     }
+    setFocus(Qt::MouseFocusReason);
     m_view->activateMonitor();
     m_moveCursor = RULER_CURSOR;
     if (event->y() > 10) {
@@ -292,7 +301,6 @@ void CustomRuler::paintEvent(QPaintEvent *e)
     offsetmin = offsetmin * m_textSpacing;
     for (f = offsetmin; f < offsetmax; f += m_textSpacing) {
         QString lab = m_timecode.getTimecodeFromFrames((int)(f / m_factor + 0.5));
-
         p.drawText(f - m_offset + 2, LABEL_SIZE, lab);
     }