Hi,
I was wondering if there is the possibility to have global scripts in place, for the whole project?
And if so, how would one do this?
Thanks in advance ^^
Greetings,
Hi,
I was wondering if there is the possibility to have global scripts in place, for the whole project?
And if so, how would one do this?
Thanks in advance ^^
Greetings,
The script is attached to the item (Project, Page or Widget). Link the script to the Project or Navigation layer for global access:
Hi,
I’m trying to achieve is a simple global script which uses right key to progress to next page and left key to go back a page. I’ve added this script to the Project Code editor.
import QtQuick 2.5
Item {
Connections {
target: document.scriptAdaptor
onEventKeyPressed: {
document.scriptAdaptor.actionTurnForward()
}
}
}
The problem is that it advances 2 or 3 pages one after another, not just one. I assume onEventKeyPressed stays active for too long. Is there a way to stop it from continuing to fire?
We’ll fix it in the next version.
Current workaround (Left/Right keys on the numeric keypad):
import QtQuick 2.5
Item {
Connections {
target: document.scriptAdaptor
onEventKeyPressed: {
timer.restart()
}
}
Timer {
id: timer
interval: 250
onTriggered: {
if (document.pressedKey == '6')
document.scriptAdaptor.actionTurnForward()
else if (document.pressedKey == '4')
document.scriptAdaptor.actionTurnBackward()
}
}
}