Skip to content

Commit

Permalink
replaced a piece of ugly code
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5042 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Mar 17, 2006
1 parent 5b98be1 commit 998c01d
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions src/legend/qgslegend.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit 998c01d

Please sign in to comment.