Skip to content

Instantly share code, notes, and snippets.

@benaryorg
Last active September 3, 2015 22:06
Show Gist options
  • Save benaryorg/4a4106d705e0ba372d7e to your computer and use it in GitHub Desktop.
Save benaryorg/4a4106d705e0ba372d7e to your computer and use it in GitHub Desktop.
very minimalistic editor in qml
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