Qt Quick Designer - JS binding
I was wondering if it is possible in Qt Quick Designer (so in design mode, not in edit mode) to add a Js Binding on a property ?
An example :
I have a JS file named globals.js containing variables :
var myvar1 = 1 var myvar2 = 2 ....
I import this file in my qml file
import "global.js" as Global
When I am in design mode in Qt Quick Designer I would like to be able to have access to this file an the variables when I add a binding on an item.
indeed, when I add a binding on a button, "Global" is not in the combo box of "Source Item" and consequently variables of the js file are not in the combo box of "Source Property" (I would like to have myvar1, myvar2, .. here).
Is there an easy way to do it ?
I tried to find in the source code of qt creator where the js file is parsing and where the list of variables are stored but I didn't succeed.. My goal was to extend qt creator to fill those combo box..
I have found a workaround but I am still open with a better idea..
I have modify this source file of qt creator "src/plugins/qmldesigner/qmldesignerextension/connectioneditor/bindingmodel.cpp"
I added the field "Global" in "Source Item" and when Global is selected in souce item I read my js file and with a regexp I add variables in "Source Property"