diff options
author | Adrian Kummerlaender | 2015-07-04 21:11:24 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2015-07-04 21:11:24 +0200 |
commit | 77220db5d2ef2eee22f8456527f2ae66ea457685 (patch) | |
tree | d3a8fb11732943f1caf8ffd83830a6f22633b195 | |
parent | efc816a292d8c6c8d51b4a445db2d867f8c86887 (diff) | |
download | MetaTerm-77220db5d2ef2eee22f8456527f2ae66ea457685.tar MetaTerm-77220db5d2ef2eee22f8456527f2ae66ea457685.tar.gz MetaTerm-77220db5d2ef2eee22f8456527f2ae66ea457685.tar.bz2 MetaTerm-77220db5d2ef2eee22f8456527f2ae66ea457685.tar.lz MetaTerm-77220db5d2ef2eee22f8456527f2ae66ea457685.tar.xz MetaTerm-77220db5d2ef2eee22f8456527f2ae66ea457685.tar.zst MetaTerm-77220db5d2ef2eee22f8456527f2ae66ea457685.zip |
Scroll to active item when list is expanded
List expansion only happens when a new item is added and as such the `onHeightChanged` signal allows for bringing the new item into view.
This work around is necessary as all my attempts to scroll with the output by e.g. using the `onExecuted` signal of `TerminalItem` failed.
Reasons for this include both the async nature of JavaScript which makes it inconvenient to enforce execution of a function at exactly the right time, as well as the height value of `terminalList` seemingly not being updated instantly.
-rw-r--r-- | MetaTerm.qml | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/MetaTerm.qml b/MetaTerm.qml index 0b2046a..9ee41a3 100644 --- a/MetaTerm.qml +++ b/MetaTerm.qml @@ -18,6 +18,7 @@ Rectangle { boundsBehavior: Flickable.StopAtBounds contentHeight: terminalList.height contentWidth: terminalList.width + pixelAligned: true Column { id: terminalList @@ -25,6 +26,8 @@ Rectangle { property int activeItem : 0 + onHeightChanged: scrollTo(activeItem) + function createItem() { var terminalItem = Qt.createComponent("TerminalItem.qml"); var instantiateTerminal = function() { |