Skip to content

Commit

Permalink
Fix for bug #442
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@6249 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Dec 13, 2006
1 parent 09fc601 commit 19d95b3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/legend/qgslegend.cpp
Expand Up @@ -286,7 +286,8 @@ void QgsLegend::mouseReleaseEvent(QMouseEvent * e)

if(!dest || !origin)
{
return;
checkLayerOrderUpdate();
return;
}

if(dest && origin && getItemPos(dest) != mItemBeingMovedOrigPos)
Expand Down Expand Up @@ -348,13 +349,7 @@ void QgsLegend::mouseReleaseEvent(QMouseEvent * e)
origLayer->setLegend((QgsLegend*)(dynamic_cast<QgsLegendItem*>(dest->parent())->nextSibling()));
}
}

std::deque<QString> layersAfterRelease = layerIDs(); //test if canvas redraw is really necessary
if(layersAfterRelease != mLayersPriorToMove)
{
// z-order has changed - update layer set
updateMapCanvasLayerSet();
}
checkLayerOrderUpdate();
}
}
mMousePressedFlag = false;
Expand Down Expand Up @@ -1745,3 +1740,16 @@ void QgsLegend::zoomToLayerExtent()
mMapCanvas->render();
mMapCanvas->refresh();
}


bool QgsLegend::checkLayerOrderUpdate()
{
std::deque<QString> layersAfterRelease = layerIDs(); //test if canvas redraw is really necessary
if(layersAfterRelease != mLayersPriorToMove)
{
// z-order has changed - update layer set
updateMapCanvasLayerSet();
return true;
}
return false;
}
3 changes: 3 additions & 0 deletions src/legend/qgslegend.h
Expand Up @@ -251,6 +251,9 @@ this item may be moved back to the original position with resetToInitialPosition
/**Checks mPixmapWidthValues and mPixmapHeightValues and sets a new icon size if necessary*/
void adjustIconSize();

/**This function compares the layer order before a drag with the current layer ordering and triggers a canvas repaint if it has changed*/
bool checkLayerOrderUpdate();

private slots:

/**Calls 'handleRightClickEvent' on the item*/
Expand Down

0 comments on commit 19d95b3

Please sign in to comment.