Skip to content

Commit

Permalink
Merge pull request #2511 from alicevision/fix/newNodeMenu
Browse files Browse the repository at this point in the history
[ui] GraphEditor.newNodeMenu: fix unstable menu height
  • Loading branch information
cbentejac authored Aug 23, 2024
2 parents 9fb1e22 + 6646bde commit f48785f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions meshroom/ui/qml/GraphEditor/GraphEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ Item {
id: newNodeMenu
property point spawnPosition
property variant menuKeys: Object.keys(root.nodeTypesModel).concat(Object.values(MeshroomApp.pipelineTemplateNames))
height: searchBar.height + nodeMenuRepeater.height + instantiator.height

function createNode(nodeType) {
uigraph.clearNodeSelection() // Ensures that only the created node / imported pipeline will be selected
Expand Down Expand Up @@ -268,10 +269,9 @@ Item {
}

onVisibleChanged: {
searchBar.clear()
if (visible) {
// when menu is shown,
// clear and give focus to the TextField filter
searchBar.clear()
// when menu is shown, give focus to the TextField filter
searchBar.forceActiveFocus()
}
}
Expand Down Expand Up @@ -343,7 +343,8 @@ Item {

// Dynamically add the menu categories
Instantiator {
model: !(searchBar.text !== "") ? Object.keys(newNodeMenu.parseCategories()).sort() : undefined
id: instantiator
model: (searchBar.text === "") ? Object.keys(newNodeMenu.parseCategories()).sort() : undefined
onObjectAdded: newNodeMenu.insertMenu(index + 1, object ) // add sub-menu under the search bar
onObjectRemoved: newNodeMenu.removeMenu(object)

Expand Down

0 comments on commit f48785f

Please sign in to comment.