Commit bd72af73 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Solved crash when using marker without any clip loaded.

parent 0a5c22db
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
PreviewRuler::PreviewRuler( QWidget* parent ) : PreviewRuler::PreviewRuler( QWidget* parent ) :
QWidget( parent ), QWidget( parent ),
m_renderer( NULL ), m_renderer( NULL ),
m_frame( NULL ) m_frame( 0 )
{ {
setMouseTracking( true ); setMouseTracking( true );
m_isSliding = false; m_isSliding = false;
...@@ -141,34 +141,35 @@ void PreviewRuler::paintEvent( QPaintEvent * event ) ...@@ -141,34 +141,35 @@ void PreviewRuler::paintEvent( QPaintEvent * event )
painter.drawLine( QLineF( r.left() + step * spacing, r.height() - MARK_LARGE, r.left() + step * spacing, r.bottom() ) ); painter.drawLine( QLineF( r.left() + step * spacing, r.height() - MARK_LARGE, r.left() + step * spacing, r.bottom() ) );
} }
} }
}
// Draw the markers (if any) // Draw the markers (if any)
painter.setPen( QPen( Qt::green, 2 ) ); painter.setPen( QPen( Qt::green, 2 ) );
if ( m_markerStart > MARKER_DEFAULT ) if ( m_markerStart > MARKER_DEFAULT )
{ {
int markerPos = m_markerStart * width() / m_renderer->getLength(); int markerPos = m_markerStart * width() / m_renderer->getLength();
QPolygon marker( 4 ); QPolygon marker( 4 );
marker.setPoints( 4, marker.setPoints( 4,
markerPos + 8, 1, markerPos + 8, 1,
markerPos, 1, markerPos, 1,
markerPos, 20, markerPos, 20,
markerPos + 8, 20 ); markerPos + 8, 20 );
painter.drawPolyline( marker ); painter.drawPolyline( marker );
} }
if ( m_markerStop > MARKER_DEFAULT ) if ( m_markerStop > MARKER_DEFAULT )
{ {
int markerPos = m_markerStop * width() / m_renderer->getLength(); int markerPos = m_markerStop * width() / m_renderer->getLength();
QPolygon marker( 4 ); QPolygon marker( 4 );
marker.setPoints( 4, marker.setPoints( 4,
markerPos - 8, 1, markerPos - 8, 1,
markerPos, 1, markerPos, 1,
markerPos, 20, markerPos, 20,
markerPos - 8, 20 ); markerPos - 8, 20 );
painter.drawPolyline( marker ); painter.drawPolyline( marker );
}
} }
// Draw the pointer // Draw the pointer
painter.setRenderHint( QPainter::Antialiasing ); painter.setRenderHint( QPainter::Antialiasing );
painter.setPen( QPen( Qt::white ) ); painter.setPen( QPen( Qt::white ) );
......
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