Skip to content

Commit 863c74a

Browse files
author
mhugent
committedJul 12, 2006
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
1 parent 9712510 commit 863c74a

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed
 

‎src/legend/qgslegend.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,21 +228,21 @@ void QgsLegend::mouseMoveEvent(QMouseEvent * e)
228228
{
229229
if(origin->parent() != dest->parent())
230230
{
231-
dest->parent()->insertChild(dest->parent()->childCount(), origin);
232-
origin->moveItem(dest);
233-
dest->moveItem(origin);
234-
}
231+
moveItem(origin, dest);
232+
moveItem(dest, origin);
233+
}
235234
else
236-
{
237-
dest->moveItem(origin);
238-
}
239-
}
240-
}
235+
{
236+
moveItem(dest, origin);
237+
}
238+
}
239+
}
241240
else //over top of item
242241
{
243242
if (mItemBeingMoved != dest->nextSibling())
244243
{
245-
origin->moveItem(dest);
244+
//origin->moveItem(dest);
245+
moveItem(origin, dest);
246246
}
247247
}
248248
setCurrentItem(origin);

‎src/legend/qgslegenditem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class QgsLegendItem : public QTreeWidgetItem
8585
QgsLegendItem* nextSibling();
8686
/**Returns the younger sibling or 0 if this item is the first child of its parent*/
8787
QgsLegendItem* findYoungerSibling();
88-
/**Moves this item after as an older sibling after another item*/
88+
/**Moves this item after (as an older sibling) another item*/
8989
void moveItem(QgsLegendItem* after);
9090
/**Removes all the children of this item. This function is for qt-4.0.1 compatibility, where
9191
'takeChildren()' does not yet exist*/

‎src/legend/qgslegendlayer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ QgsLegendItem::DRAG_ACTION QgsLegendLayer::accept(const QgsLegendItem* li) const
9393
LEGEND_ITEM_TYPE type = li->type();
9494
if ( type == LEGEND_LAYER)
9595
{
96-
if(parent() == li->parent())
97-
{
96+
//if(parent() == li->parent())
97+
//{
9898
return REORDER;
99-
}
99+
//}
100100
}
101101
else if(type == LEGEND_GROUP)
102102
{

0 commit comments

Comments
 (0)
Please sign in to comment.