Advertisement
Guest User

Untitled

a guest
Oct 30th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 0.76 KB | None | 0 0
  1. ApplicationWindow {
  2.     id: app
  3.     visible: true
  4.     function readFile(){
  5.         var request = new XMLHttpRequest()
  6.         request.open('GET', 'qrc:/Kommilitonen.txt')
  7.         request.onreadystatechange = function(event){
  8.             if(request.readyState === XMLHttpRequest.DONE){
  9.                 console.log("txt geladen");
  10.                 console.log(request.responseText);
  11.                 view.model = JSON.parse(request.responseText)
  12.             }
  13.         }
  14.         request.send();
  15.     }
  16.  
  17.  
  18.     //id: root
  19.     width: 800; height: 800
  20.  
  21.     ListView {
  22.         id: view
  23.         anchors { fill: parent; margins: 2 }
  24.         model: KommilitonenModel{}
  25.         delegate: KommilitonenDelegate{}
  26.         Component.onCompleted: readFile();
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement