Legend: allow swapping of legend layers between toplevel layers and layers in a group (motivated by ticket #148 'Legend groups capture legend items')

git-svn-id: http://svn.osgeo.org/qgis/trunk@5586 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
mhugent 2006-07-12 09:32:58 +00:00
parent 9712510d9b
commit 863c74a385
3 changed files with 14 additions and 14 deletions

View File

@ -228,21 +228,21 @@ void QgsLegend::mouseMoveEvent(QMouseEvent * e)
{
if(origin->parent() != dest->parent())
{
dest->parent()->insertChild(dest->parent()->childCount(), origin);
origin->moveItem(dest);
dest->moveItem(origin);
}
moveItem(origin, dest);
moveItem(dest, origin);
}
else
{
dest->moveItem(origin);
}
}
}
{
moveItem(dest, origin);
}
}
}
else //over top of item
{
if (mItemBeingMoved != dest->nextSibling())
{
origin->moveItem(dest);
//origin->moveItem(dest);
moveItem(origin, dest);
}
}
setCurrentItem(origin);

View File

@ -85,7 +85,7 @@ public:
QgsLegendItem* nextSibling();
/**Returns the younger sibling or 0 if this item is the first child of its parent*/
QgsLegendItem* findYoungerSibling();
/**Moves this item after as an older sibling after another item*/
/**Moves this item after (as an older sibling) another item*/
void moveItem(QgsLegendItem* after);
/**Removes all the children of this item. This function is for qt-4.0.1 compatibility, where
'takeChildren()' does not yet exist*/

View File

@ -93,10 +93,10 @@ QgsLegendItem::DRAG_ACTION QgsLegendLayer::accept(const QgsLegendItem* li) const
LEGEND_ITEM_TYPE type = li->type();
if ( type == LEGEND_LAYER)
{
if(parent() == li->parent())
{
//if(parent() == li->parent())
//{
return REORDER;
}
//}
}
else if(type == LEGEND_GROUP)
{