From ef1cadad0c1182528a64c7ba165e19a6ab976421 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Fri, 14 Aug 2015 16:49:09 -0400 Subject: [PATCH] Make cursor change when hovering over handle. --- glabels/LabelModelObject.cpp | 17 ++++++++++------- glabels/View.cpp | 8 ++++++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/glabels/LabelModelObject.cpp b/glabels/LabelModelObject.cpp index 39e9ef2..7afab10 100644 --- a/glabels/LabelModelObject.cpp +++ b/glabels/LabelModelObject.cpp @@ -925,15 +925,18 @@ namespace glabels /// Handle* LabelModelObject::handleAt( double scale, double x, double y ) const { - QPointF p( x, y ); - p -= QPointF( mX0, mY0 ); // Translate point to x0,y0 - - foreach ( Handle* handle, mHandles ) + if ( mSelectedFlag ) { - QPainterPath handlePath = mMatrix.map( handle->path( scale ) ); - if ( handlePath.contains( p ) ) + QPointF p( x, y ); + p -= QPointF( mX0, mY0 ); // Translate point to x0,y0 + + foreach ( Handle* handle, mHandles ) { - return handle; + QPainterPath handlePath = mMatrix.map( handle->path( scale ) ); + if ( handlePath.contains( p ) ) + { + return handle; + } } } diff --git a/glabels/View.cpp b/glabels/View.cpp index 688895e..a79c6ee 100644 --- a/glabels/View.cpp +++ b/glabels/View.cpp @@ -345,8 +345,12 @@ glabels::View::mouseMoveEvent( QMouseEvent* event ) { case IdleState: - /* @TODO handle handles. */ - if ( mModel->objectAt( mZoom, xWorld, yWorld ) ) + if ( mModel->isSelectionAtomic() && + mModel->handleAt( mZoom, xWorld, yWorld ) ) + { + setCursor( Qt::CrossCursor ); + } + else if ( mModel->objectAt( mZoom, xWorld, yWorld ) ) { setCursor( Qt::SizeAllCursor ); }