forked from jitendra-khasdev/NEKeditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.qml
67 lines (58 loc) · 1.39 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import QtQuick 2.1
import QtQuick.Layouts 1.0
import QtQuick.Window 2.0
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2
import NEKeditor 1.0
Window {
visible: true
width: Screen.desktopAvailableWidth
height: Screen.desktopAvailableHeight
TextArea {
Accessible.name: "document"
id: textArea
width: parent.width
anchors.top: newButton.bottom
anchors.bottom: parent.bottom
baseUrl: "qrc:/"
text: document.text
font.pointSize: 12
Component.onCompleted: forceActiveFocus()
}
ToolButton {
id: newButton
x: 0
y: 0
text: "New"
onClicked: document.fileUrl = "qrc:/"
}
ToolButton {
id: openButton
y: 0
anchors.left: newButton.right
text: "Open"
onClicked: fileDialog.open()
}
ToolButton {
id: saveButton
y: 0
anchors.left: openButton.right
text: "Save"
onClicked: {
nektechio.save(textArea.text)
console.log("save button clicked")
}
}
FileDialog{
id: fileDialog
nameFilters: ["C Files (*.c)", "C++ Files (*.cpp)"]
onAccepted: {
document.fileUrl = fileUrl
}
}
NEKTech_Doc_Handler{
id: document
target: textArea
Component.onCompleted: document.fileUrl = "qrc:/nektech.c"
}
}