From 4cb435f2a7bbeafb53f067d95ec83e0b3a1a17f8 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Wed, 19 Aug 2015 11:13:35 +0200 Subject: Extract all settings into `SettingsHandler` object This enables the user to straight forwardly change all application settings via command mode. During the implementation of this change I discovered that the way I was passing around `StateHandler` and `SettingsHandler` instances using properties was unnecessary. If all object instances are created in a common hierarchy they can access each other by their `id` property - i.e. `settings` and `mode` are available to the whole application without property trickery. --- src/list/TerminalList.qml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/list/TerminalList.qml') diff --git a/src/list/TerminalList.qml b/src/list/TerminalList.qml index 6c6465b..9c1636f 100644 --- a/src/list/TerminalList.qml +++ b/src/list/TerminalList.qml @@ -4,12 +4,13 @@ import QtQuick.Layouts 1.1 Item { id: item - property StateHandler state : null - property int activeItem : 0 - property int itemIndex : 0 + property int activeItem : 0 + property int itemIndex : 0 property alias children : column.children + property Component terminalItem : Component { TerminalItem { } } + function onItemExecuted(index) { if ( index === (children.length - 1) ) { createItem(); @@ -17,11 +18,10 @@ Item { } function createItem() { - var terminalItem = Qt.createComponent("qrc:/TerminalItem.qml"); var instantiateTerminal = function() { var instance = terminalItem.createObject(column, { - "index": itemIndex, - "width": flickable.width + "index" : itemIndex, + "width" : flickable.width }); instance.onExecuted.connect(onItemExecuted); @@ -67,7 +67,7 @@ Item { if ( activeItem < (children.length - 1) ) { selectItem(activeItem + 1); } else { - state.enterInsertMode(); + mode.enterInsertMode(); } } -- cgit v1.2.3