Skip to content

Commit 0f7336e

Browse files
committedJul 27, 2018
[maptips] fix maptips showing after mouse leave the canvas area
1 parent d9ee419 commit 0f7336e

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11653,20 +11653,24 @@ void QgisApp::removeMapToolMessage()
1165311653
// Show the maptip using tooltip
1165411654
void QgisApp::showMapTip()
1165511655
{
11656-
QPoint myPointerPos = mMapCanvas->mouseLastXY();
11657-
11658-
// Make sure there is an active layer before proceeding
11659-
QgsMapLayer *mypLayer = mMapCanvas->currentLayer();
11660-
if ( mypLayer )
11656+
// Only show maptips if the mouse is still over the map canvas when timer is triggered
11657+
if ( mMapCanvas->underMouse() )
1166111658
{
11662-
//QgsDebugMsg("Current layer for maptip display is: " + mypLayer->source());
11663-
// only process vector layers
11664-
if ( mypLayer->type() == QgsMapLayer::VectorLayer )
11659+
QPoint myPointerPos = mMapCanvas->mouseLastXY();
11660+
11661+
// Make sure there is an active layer before proceeding
11662+
QgsMapLayer *mypLayer = mMapCanvas->currentLayer();
11663+
if ( mypLayer )
1166511664
{
11666-
// Show the maptip if the maptips button is depressed
11667-
if ( mMapTipsVisible )
11665+
// QgsDebugMsg("Current layer for maptip display is: " + mypLayer->source());
11666+
// only process vector layers
11667+
if ( mypLayer->type() == QgsMapLayer::VectorLayer )
1166811668
{
11669-
mpMaptip->showMapTip( mypLayer, mLastMapPosition, myPointerPos, mMapCanvas );
11669+
// Show the maptip if the maptips button is depressed
11670+
if ( mMapTipsVisible )
11671+
{
11672+
mpMaptip->showMapTip( mypLayer, mLastMapPosition, myPointerPos, mMapCanvas );
11673+
}
1167011674
}
1167111675
}
1167211676
}

0 commit comments

Comments
 (0)
Please sign in to comment.