diff options
author | Adrian Kummerlaender | 2015-07-25 20:07:14 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2015-07-25 20:07:14 +0200 |
commit | 1ed6dfcd2eb9878b2ad25c42358d9a21839a1951 (patch) | |
tree | af61cd98c79b768c40a22fb74e4d174ffc999772 /qml/main.qml | |
parent | 18538591a6226e79e5add5dfc084ab8701e1fd3b (diff) | |
download | MetaTerm-1ed6dfcd2eb9878b2ad25c42358d9a21839a1951.tar MetaTerm-1ed6dfcd2eb9878b2ad25c42358d9a21839a1951.tar.gz MetaTerm-1ed6dfcd2eb9878b2ad25c42358d9a21839a1951.tar.bz2 MetaTerm-1ed6dfcd2eb9878b2ad25c42358d9a21839a1951.tar.lz MetaTerm-1ed6dfcd2eb9878b2ad25c42358d9a21839a1951.tar.xz MetaTerm-1ed6dfcd2eb9878b2ad25c42358d9a21839a1951.tar.zst MetaTerm-1ed6dfcd2eb9878b2ad25c42358d9a21839a1951.zip |
Reimplemented `delete` command as more of a `reset` command
Pressing `d` in normal mode causes the current embedded terminal to be destroyed and the containing terminal item to be reset into its initial state.
This allows for much more flexible usage of _MetaTerm_.
To prevent unnecessary terminal item instantiations the `onExecuted` signal was extended to provide a `index` argument containing the sender terminal's index.
Diffstat (limited to 'qml/main.qml')
-rw-r--r-- | qml/main.qml | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/qml/main.qml b/qml/main.qml index f9e7162..836f97c 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -38,6 +38,12 @@ ApplicationWindow { onHeightChanged: scrollTo(activeItem) + function onItemExecuted(index) { + if ( index === (children.length - 1) ) { + createItem(); + } + } + function createItem() { var terminalItem = Qt.createComponent("qrc:/TerminalItem.qml"); var instantiateTerminal = function() { @@ -45,7 +51,7 @@ ApplicationWindow { "index": itemIndex, "width": terminalListFlickable.width }); - instance.onExecuted.connect(createItem); + instance.onExecuted.connect(onItemExecuted); ++itemIndex; } @@ -110,12 +116,6 @@ ApplicationWindow { function getCurrent() { return children[activeItem]; } - - function deleteCurrent() { - if ( children[activeItem].terminal != null ) { - children[activeItem].destroy(); - } - } } } |