Skip to content

Commit

Permalink
a little improvement to avoid flickering when a legendlayerfile is dr…
Browse files Browse the repository at this point in the history
…agged

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4345 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Dec 15, 2005
1 parent bf7d5e2 commit 419926f
Showing 1 changed file with 5 additions and 30 deletions.
35 changes: 5 additions & 30 deletions src/legend/qgslegend.cpp
Expand Up @@ -165,25 +165,9 @@ 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);
QgsLegendItem* origin = dynamic_cast<QgsLegendItem*>(mItemBeingMoved);
Expand All @@ -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);
}
}
Expand All @@ -249,7 +221,10 @@ void QgsLegend::mouseMoveEvent(QMouseEvent * e)
#ifdef QGISDEBUG
qWarning("mouseMoveEvent::NO_ACTION");
#endif
resetToInitialPosition(mItemBeingMoved);
if(mItemBeingMovedOrigPos != getItemPos(mItemBeingMoved))
{
resetToInitialPosition(mItemBeingMoved);
}
setCursor( QCursor(Qt::ForbiddenCursor) );
}
}
Expand Down

0 comments on commit 419926f

Please sign in to comment.