[ui] GraphEditor: trigger fit on project opening

* fit when the underlying graph has changed (new/open project)
* add 'F' shortcut to fit
* trigger fit after UI has been fully initialized (correct sizes)
This commit is contained in:
Yann Lanthony 2018-07-27 17:55:01 +02:00
parent 53be806019
commit c3464fa4e8
2 changed files with 18 additions and 0 deletions

View file

@ -21,6 +21,16 @@ Item {
signal workspaceClicked()
signal nodeDoubleClicked(var node)
// trigger initial fit() after initialization
// (ensure GraphEditor has its final size)
Component.onCompleted: firstFitTimer.start()
Timer {
id: firstFitTimer
running: false
interval: 10
onTriggered: fit()
}
clip: true
@ -49,6 +59,12 @@ Item {
selectNode(nodes[0])
}
Keys.onPressed: {
if(event.key === Qt.Key_F)
fit()
}
MouseArea {
id: mouseArea
anchors.fill: parent