Commit b1e0e4c4 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen
Browse files

Reconnected ruler cursor.

parent 27a87c5a
......@@ -24,8 +24,7 @@
#include "GraphicsCursorItem.h"
GraphicsCursorItem::GraphicsCursorItem( const QPen& pen ) :
m_pen( pen ),
m_manualMove( true )
m_pen( pen )
{
setFlags( QGraphicsItem::ItemIgnoresTransformations | QGraphicsItem::ItemIsMovable );
setCursor( QCursor( Qt::SizeHorCursor ) );
......@@ -57,8 +56,7 @@ QVariant GraphicsCursorItem::itemChange( GraphicsItemChange change, const QVaria
//The position HAS changed, ie we released the slider, or setPos has been called.
else if ( change == ItemPositionHasChanged )
{
if ( m_manualMove == true )
emit cursorPositionChanged( ( qint64 ) pos().x() );
emit cursorPositionChanged( ( qint64 ) pos().x() );
}
return QGraphicsItem::itemChange( change, value );
}
......@@ -67,9 +65,7 @@ void GraphicsCursorItem::frameChanged( qint64 newFrame, MainWorkflow::FrameChang
{
if ( reason != MainWorkflow::TimelineCursor )
{
m_manualMove = false;
setPos( newFrame, pos().y() );
m_manualMove = true;
}
}
......
......@@ -48,7 +48,6 @@ protected:
private:
QPen m_pen;
QRectF m_boundingRect;
bool m_manualMove;
signals:
void cursorPositionChanged( qint64 pos );
......
......@@ -86,6 +86,9 @@ Timeline::Timeline( WorkflowRenderer* renderer, QWidget *parent ) :
Qt::QueuedConnection );
connect( m_tracksView->tracksCursor(), SIGNAL( cursorPositionChanged( qint64 ) ),
m_renderer, SLOT( timelineCursorChanged(qint64) ) );
connect( m_renderer, SIGNAL( frameChanged(qint64,MainWorkflow::FrameChangedReason) ), m_tracksRuler, SLOT( update() ) );
connect( m_tracksRuler, SIGNAL( frameChanged(qint64,MainWorkflow::FrameChangedReason) ),
m_renderer, SLOT( timelineCursorChanged(qint64) ) );
m_tracksView->createLayout();
}
......
......@@ -173,7 +173,7 @@ void TracksRuler::mousePressEvent( QMouseEvent* event )
if ( event->buttons() == Qt::LeftButton &&
event->modifiers() == Qt::NoModifier )
{
m_tracksView->setCursorPos( ( int ) ( ( event->x() + offset() ) / m_factor ) );
emit frameChanged( (qreal)( event->x() + offset() ) / m_factor, MainWorkflow::RulerCursor );
}
}
......@@ -182,7 +182,7 @@ void TracksRuler::mouseMoveEvent( QMouseEvent* event )
if ( event->buttons() == Qt::LeftButton &&
event->modifiers() == Qt::NoModifier )
{
m_tracksView->setCursorPos( ( int ) ( ( event->x() + offset() ) / m_factor ) );
emit frameChanged( (qreal)( event->x() + offset() ) / m_factor, MainWorkflow::RulerCursor );
}
}
......
......@@ -75,6 +75,9 @@ private:
int m_littleMarkDistance;
int m_mediumMarkDistance;
int m_bigMarkDistance;
signals:
void frameChanged( qint64, MainWorkflow::FrameChangedReason );
};
#endif // TRACKSRULER_H
......@@ -59,6 +59,7 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
Renderer,
TimelineCursor,
PreviewCursor,
RulerCursor,
};
void addClip( Clip* clip, unsigned int trackId, qint64 start, TrackType type );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment