// Parses an XML file using DOM and shows the structure in the listview in the PlayGround function parseXML() { var fn = FileDialog.getOpenFileName(); if ( fn.isEmpty() ) return; var f = new File( fn ); if ( !f.open( f.ReadOnly ) ) return; var d = new DomDocument( f.readAll() ); listView.clear(); var i = new QListViewItem( listView ); i.open = true; i.setText( 0, "" ); i.setText( 1, "Document" ); insertNode( d.firstChild(), i ); } // Helper function for the XML parsing private function insertNode( n, i ) { var parent = i; for ( ; !n.isNull; n = n.nextSibling() ) { t = n.toText(); if ( !t.isNull ) { i = new QListViewItem( parent ); i.open = true; i.setText( 0, "Text" ); i.setText( 1, t.data ); continue; } e = n.toElement(); if ( !e.isNull ) { i = new QListViewItem( parent ); i.open = true; i.setText( 0, "Element" ); i.setText( 1, e.tagName ); insertNode( n.firstChild(), i ); } } } // connect signals and slots in code function connectSliderAndLCDNumber() { connect( slider, "valueChanged(int)", lcdNumber, "display(int)" ); MessageBox.information( "Connected slider and LCDNumber. Move the slider!!!", "Info" ); }