mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
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:
parent
04095b9eea
commit
f97e9faf72
@ -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);
|
||||
@ -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
|
||||
resetToInitialPosition(mItemBeingMoved);
|
||||
if(mItemBeingMovedOrigPos != getItemPos(mItemBeingMoved))
|
||||
{
|
||||
resetToInitialPosition(mItemBeingMoved);
|
||||
}
|
||||
setCursor( QCursor(Qt::ForbiddenCursor) );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user