Use iterator to traverse XML tree

elementsByTagName() may return an empty list thought there should be
elements. As the reason and circumstances of the method for doing so
are unclear, an iterator approach is used instead

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
This commit is contained in:
Achim Settelmeier
2009-05-29 01:07:51 +02:00
committed by Tobias Doerffel
parent cc317032e3
commit 9adc592fb5

View File

@@ -318,11 +318,11 @@ void MidiControlListener::readConfiguration()
}
// now read action tags
QDomNodeList actionNodes = s_configTree.elementsByTagName( "action" );
for( uint i = 0; i < actionNodes.length(); ++i )
// use iterator instead of elementsByTagName(), which under unsetteled circumstances returns an empty list
for( QDomElement actionNode = s_configTree.firstChildElement( "action" );
!actionNode.isNull();
actionNode = actionNode.nextSiblingElement("action") )
{
QDomElement actionNode = actionNodes.at( i ).toElement();
EventAction action = actionName2ActionNameMap( actionNode.attribute( "actionName" ) ).action;
if( actionNode.attribute( "type" ) == "key" )