EffectComposer: Fix scroll to end when adding a node

Change-Id: Id13a825cedfe98500337d1914bda064c2f5e3bb3
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Mahmoud Badri
2024-02-16 14:57:41 +02:00
parent 788d4c0040
commit d83a464615
2 changed files with 13 additions and 0 deletions

View File

@@ -145,6 +145,8 @@ ColumnLayout {
color: StudioTheme.Values.themeToolbarBackground color: StudioTheme.Values.themeToolbarBackground
EffectNodesComboBox { EffectNodesComboBox {
id: nodesComboBox
mainRoot: root mainRoot: root
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -197,6 +199,14 @@ ColumnLayout {
clip: true clip: true
interactive: !HelperWidgets.Controller.contextMenuOpened interactive: !HelperWidgets.Controller.contextMenuOpened
onContentHeightChanged: {
if (nodesComboBox.nodeJustAdded && scrollView.contentItem.height > scrollView.height) {
let lastItemH = repeater.itemAt(repeater.count - 1).height
scrollView.contentY = scrollView.contentItem.height - lastItemH
nodesComboBox.nodeJustAdded = false
}
}
Column { Column {
id: nodesCol id: nodesCol
width: scrollView.width width: scrollView.width

View File

@@ -22,6 +22,8 @@ StudioControls.ComboBox {
readonly property int popupHeight: Math.min(800, row.height + 2) readonly property int popupHeight: Math.min(800, row.height + 2)
property bool nodeJustAdded: false
function calculateWindowGeometry() { function calculateWindowGeometry() {
var globalPos = EffectComposerBackend.rootView.globalPos(mainRoot.mapFromItem(root, 0, 0)) var globalPos = EffectComposerBackend.rootView.globalPos(mainRoot.mapFromItem(root, 0, 0))
var screenRect = EffectComposerBackend.rootView.screenRect(); var screenRect = EffectComposerBackend.rootView.screenRect();
@@ -117,6 +119,7 @@ StudioControls.ComboBox {
onAddEffectNode: (nodeQenPath) => { onAddEffectNode: (nodeQenPath) => {
EffectComposerBackend.rootView.addEffectNode(modelData.nodeQenPath) EffectComposerBackend.rootView.addEffectNode(modelData.nodeQenPath)
root.popup.close() root.popup.close()
root.nodeJustAdded = true
} }
} }
} }