Last active
September 3, 2015 22:06
-
-
Save benaryorg/4a4106d705e0ba372d7e to your computer and use it in GitHub Desktop.
very minimalistic editor in qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import QtQuick 2.2 | |
import QtQuick.Controls 1.2 | |
import QtQuick.Dialogs 1.0 | |
ApplicationWindow | |
{ | |
visible: true | |
title: "Meow" | |
id: win | |
TextArea | |
{ | |
id: area | |
anchors.fill: parent | |
anchors.margins: 11 | |
readOnly: true | |
} | |
FileDialog | |
{ | |
id: dialog | |
title: "Please choose a file" | |
Component.onCompleted: visible=true | |
onAccepted: | |
{ | |
var xhr=new XMLHttpRequest; | |
xhr.open("GET",dialog.fileUrl); | |
xhr.onreadystatechange=function() | |
{ | |
if(xhr.readyState==XMLHttpRequest.DONE) | |
{ | |
area.text=xhr.responseText; | |
} | |
} | |
xhr.send(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment