Skip to content
Permalink
Browse files

replaced a piece of ugly code

git-svn-id: http://svn.osgeo.org/qgis/trunk@5042 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Mar 17, 2006
1 parent a87d4e4 commit 05ae9a0760fd24f150b6ddca2200ad8f8881b264
Showing with 12 additions and 20 deletions.
  1. +12 −20 src/legend/qgslegend.cpp
@@ -1141,32 +1141,24 @@ QTreeWidgetItem* QgsLegend::previousSibling(QTreeWidgetItem* item)

QDomNode QgsLegend::nextDomNode(const QDomNode& theNode)
{
//todo: generalise this for arbitrary deep trees
if(!theNode.firstChild().isNull())
{
return (theNode.firstChild());
}
else if(!theNode.nextSibling().isNull())
{
return (theNode.nextSibling());
}
else if(!theNode.parentNode().isNull() && !theNode.parentNode().nextSibling().isNull())
{
return (theNode.parentNode().nextSibling());
}
else if(!theNode.parentNode().isNull() && !theNode.parentNode().parentNode().isNull() && !theNode.parentNode().parentNode().nextSibling().isNull())
{
return (theNode.parentNode().parentNode().nextSibling());
}
else if(!theNode.parentNode().isNull() && !theNode.parentNode().parentNode().isNull() && !theNode.parentNode().parentNode().parentNode().isNull() && !theNode.parentNode().parentNode().parentNode().nextSibling().isNull())
{
return (theNode.parentNode().parentNode().parentNode().nextSibling());
}
else

QDomNode currentNode = theNode;
do
{
QDomNode nullNode;
return nullNode;
if(!currentNode.nextSibling().isNull())
{
return currentNode.nextSibling();
}
currentNode = currentNode.parentNode();
}
while(!currentNode.isNull());

QDomNode nullNode;
return nullNode;
}

void QgsLegend::insertItem(QTreeWidgetItem* move, QTreeWidgetItem* into)

0 comments on commit 05ae9a0

Please sign in to comment.
You can’t perform that action at this time.