Skip to content
Permalink
Browse files
Show ruler marker for cursor position
  • Loading branch information
mhugent committed Feb 14, 2013
1 parent 38c5214 commit 5f8e9e13245ce6ff66542b0bce5e13081595f692
Showing with 16 additions and 2 deletions.
  1. +5 −2 src/gui/qgscomposerruler.cpp
  2. +2 −0 src/gui/qgscomposerruler.h
  3. +9 −0 src/gui/qgscomposerview.cpp
@@ -48,8 +48,8 @@ void QgsComposerRuler::paintEvent( QPaintEvent* event )
markerPos += 10.0;
}

qWarning( QString::number( startX ).toLocal8Bit().data() );
qWarning( QString::number( endX ).toLocal8Bit().data() );
p.setPen( QColor( Qt::red ) );
p.drawLine( mMarkerPos.x(), 0, mMarkerPos.x(), RULER_MIN_SIZE );
}
else //vertical
{
@@ -72,6 +72,9 @@ void QgsComposerRuler::paintEvent( QPaintEvent* event )
}
markerPos += 10.0;
}

p.setPen( QColor( Qt::red ) );
p.drawLine( 0, mMarkerPos.y(), RULER_MIN_SIZE, mMarkerPos.y() );
}
}

@@ -19,13 +19,15 @@ class QgsComposerRuler: public QWidget
QSize minimumSizeHint() const;

void setSceneTransform( const QTransform& transform );
void updateMarker( const QPointF& pos ) { mMarkerPos = pos; repaint(); }

protected:
void paintEvent( QPaintEvent* event );

private:
Direction mDirection;
QTransform mTransform;
QPointF mMarkerPos;
};

#endif // QGSCOMPOSERRULER_H
@@ -368,6 +368,15 @@ void QgsComposerView::mouseMoveEvent( QMouseEvent* e )
return;
}

if ( mHorizontalRuler )
{
mHorizontalRuler->updateMarker( e->posF() );
}
if ( mVerticalRuler )
{
mVerticalRuler->updateMarker( e->posF() );
}

if ( e->buttons() == Qt::NoButton )
{
if ( mCurrentTool == Select )

0 comments on commit 5f8e9e1

Please sign in to comment.