Skip to content
Permalink
Browse files
better method to check if a canvas redraw is necessary after a drag i…
…n the legend

git-svn-id: http://svn.osgeo.org/qgis/trunk@4934 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Mar 1, 2006
1 parent dd657c9 commit 25789d849e14faf69bafc4d8f6a58175a4c10969
Showing with 13 additions and 2 deletions.
  1. +8 −2 src/legend/qgslegend.cpp
  2. +5 −0 src/legend/qgslegend.h
@@ -242,7 +242,6 @@ void QgsLegend::mouseMoveEvent(QMouseEvent * e)
}
}
}
//QTreeWidget::mouseMoveEvent(e);
}

void QgsLegend::mouseReleaseEvent(QMouseEvent * e)
@@ -325,7 +324,13 @@ void QgsLegend::mouseReleaseEvent(QMouseEvent * e)
origLayer->setLegend((QgsLegend*)(dynamic_cast<QgsLegendItem*>(dest->parent())->nextSibling()));
}
}
emit zOrderChanged(this);

std::deque<QString> layersAfterRelease = layerIDs(); //test if canvas redraw is really necessary
if(layersAfterRelease != mLayersPriorToMove)
{
emit zOrderChanged(this);
}

}
}
mMousePressedFlag = false;
@@ -989,6 +994,7 @@ void QgsLegend::storeInitialPosition(QTreeWidgetItem* li)
mRestoreInformation = YOUNGER_SIBLING;
mRestoreItem = ((QgsLegendItem*)(li))->findYoungerSibling();
}
mLayersPriorToMove = layerIDs();
}

void QgsLegend::resetToInitialPosition(QTreeWidgetItem* li)
@@ -222,6 +222,7 @@ this item may be moved back to the original position with resetToInitialPosition
/**Returns the legend layer to which a map layer gelongs*/
QgsLegendLayer* findLegendLayer(const QString& layerKey);


private slots:

/**Calls 'handleRightClickEvent' on the item*/
@@ -294,6 +295,10 @@ this item may be moved back to the original position with resetToInitialPosition

bool mShowLegendLayerFiles;

/**Stores the layer ordering before a mouse Move. After the move, this is used to
decide if the mapcanvas really has to be refreshed*/
std::deque<QString> mLayersPriorToMove;

/*!
* A fuction sed to determin how far down in the list an item is (starting with one for the first Item.
*If the item is not in the legend, -1 is returned

0 comments on commit 25789d8

Please sign in to comment.