a little improvement to avoid flickering when a legendlayerfile is dragged

git-svn-id: http://svn.osgeo.org/qgis/trunk@4345 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
mhugent 2005-12-15 22:22:26 +00:00
parent 04095b9eea
commit f97e9faf72

View File

@ -165,24 +165,8 @@ void QgsLegend::mouseMoveEvent(QMouseEvent * e)
}
else if (mItemBeingMoved)
{
// scroll list if we're near the edge of the viewport
// code lifted from the poa project: http://poa.berlios.de/
//QPoint p(contentsToViewport(e->pos()));
QPoint p(e->pos());
mLastPressPos=p;
//if (p.y() < AUTOSCROLL_MARGIN)
//{
// scroll up
//scrollContentsBy(0, -(AUTOSCROLL_MARGIN - p.y()));
//}
//else if (p.y() > visibleHeight() - AUTOSCROLL_MARGIN)
//else if (p.y() > height() - AUTOSCROLL_MARGIN)
//{
// scroll down
//scrollContentsBy(0, (p.y() - (visibleHeight() - AUTOSCROLL_MARGIN)));
//scrollContentsBy(0, (p.y() - (height() - AUTOSCROLL_MARGIN)));
//}
// change the cursor appropriate to if drop is allowed
QTreeWidgetItem* item = itemAt(p);
@ -203,32 +187,20 @@ void QgsLegend::mouseMoveEvent(QMouseEvent * e)
{
if(origin->parent() != dest->parent())
{
#ifdef QGISDEBUG
qWarning("section1");
#endif
dest->parent()->insertChild(dest->parent()->childCount(), origin);
origin->moveItem(dest);
dest->moveItem(origin);
}
else
{
#ifdef QGISDEBUG
qWarning("section2");
#endif
dest->moveItem(origin);
}
}
}
else //over top of item
{
#ifdef QGISDEBUG
qWarning("over the top");
#endif
if (mItemBeingMoved != dest->nextSibling())
{
#ifdef QGISDEBUG
qWarning("origin->moveItem(dest)");
#endif
origin->moveItem(dest);
}
}
@ -249,7 +221,10 @@ void QgsLegend::mouseMoveEvent(QMouseEvent * e)
#ifdef QGISDEBUG
qWarning("mouseMoveEvent::NO_ACTION");
#endif
if(mItemBeingMovedOrigPos != getItemPos(mItemBeingMoved))
{
resetToInitialPosition(mItemBeingMoved);
}
setCursor( QCursor(Qt::ForbiddenCursor) );
}
}