mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
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:
parent
9712510d9b
commit
863c74a385
@ -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);
|
||||
|
@ -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*/
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user