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

Timeline: Nasty hack to prevent track cursor to be moved along Y axis

parent 136e58ab
......@@ -70,6 +70,13 @@ void GraphicsCursorItem::mousePressEvent( QGraphicsSceneMouseEvent* event )
QGraphicsItem::mousePressEvent( event );
}
void
GraphicsCursorItem::mouseMoveEvent( QGraphicsSceneMouseEvent *event )
{
QGraphicsItem::mouseMoveEvent( event );
setPos( pos().x(), 0.0 );
}
void GraphicsCursorItem::mouseReleaseEvent( QGraphicsSceneMouseEvent* event )
{
m_mouseDown = false;
......
......@@ -30,22 +30,23 @@
#include <QPainter>
#include <QCursor>
#include <QGraphicsSceneMouseEvent>
#include "GenericRenderer.h"
#include "MainWorkflow.h"
class GraphicsCursorItem : public QObject, public QGraphicsItem
{
Q_OBJECT
public:
GraphicsCursorItem( const QPen& pen );
int cursorPos() const { return ( int )pos().x(); }
virtual QRectF boundingRect() const;
void setHeight( int height );
int cursorPos() const { return ( int )pos().x(); }
virtual QRectF boundingRect() const;
void setHeight( int height );
protected:
virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0 );
virtual QVariant itemChange( GraphicsItemChange change, const QVariant& value );
virtual void mousePressEvent( QGraphicsSceneMouseEvent* event );
virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent* event );
virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0 );
virtual QVariant itemChange( GraphicsItemChange change, const QVariant& value );
virtual void mousePressEvent( QGraphicsSceneMouseEvent* event );
virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent* event );
virtual void mouseMoveEvent( QGraphicsSceneMouseEvent *event );
private:
QPen m_pen;
......
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