aboutsummaryrefslogtreecommitdiff
path: root/qml/main.qml
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-07-24 22:54:12 +0200
committerAdrian Kummerlaender2015-07-24 22:54:12 +0200
commit18538591a6226e79e5add5dfc084ab8701e1fd3b (patch)
treec3804e54a599e97a2ea9e98d33fe0f37568ac6bf /qml/main.qml
parent607e86675e831a1fa70de5b2813a0e0f9d1bbd56 (diff)
downloadMetaTerm-18538591a6226e79e5add5dfc084ab8701e1fd3b.tar
MetaTerm-18538591a6226e79e5add5dfc084ab8701e1fd3b.tar.gz
MetaTerm-18538591a6226e79e5add5dfc084ab8701e1fd3b.tar.bz2
MetaTerm-18538591a6226e79e5add5dfc084ab8701e1fd3b.tar.lz
MetaTerm-18538591a6226e79e5add5dfc084ab8701e1fd3b.tar.xz
MetaTerm-18538591a6226e79e5add5dfc084ab8701e1fd3b.tar.zst
MetaTerm-18538591a6226e79e5add5dfc084ab8701e1fd3b.zip
Implemented basic delete command in normal mode
Diffstat (limited to 'qml/main.qml')
-rw-r--r--qml/main.qml17
1 files changed, 12 insertions, 5 deletions
diff --git a/qml/main.qml b/qml/main.qml
index 11337f3..f9e7162 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -8,7 +8,10 @@ ApplicationWindow {
visible: true
color: "#161616"
- Component.onCompleted: terminalList.focusCurrent()
+ Component.onCompleted: {
+ terminalList.createItem();
+ terminalList.focusCurrent();
+ }
Flickable {
id: terminalListFlickable
@@ -24,6 +27,7 @@ ApplicationWindow {
id: terminalList
property int activeItem : 0
+ property int itemIndex : 0
anchors {
left: parent.left
@@ -38,10 +42,12 @@ ApplicationWindow {
var terminalItem = Qt.createComponent("qrc:/TerminalItem.qml");
var instantiateTerminal = function() {
var instance = terminalItem.createObject(terminalList, {
- "index": terminalList.children.length,
+ "index": itemIndex,
"width": terminalListFlickable.width
});
instance.onExecuted.connect(createItem);
+
+ ++itemIndex;
}
if ( terminalItem.status === Component.Ready ) {
@@ -105,9 +111,10 @@ ApplicationWindow {
return children[activeItem];
}
- TerminalItem {
- width: terminalListFlickable.width
- onExecuted: terminalList.createItem()
+ function deleteCurrent() {
+ if ( children[activeItem].terminal != null ) {
+ children[activeItem].destroy();
+ }
}
}
}