How to create a js code snippet and debug it in Qt Quick



  • Dear All,

    I try to get some js code snippet executed.

    I have this procedural js code from an application which is built the JS engine in Qt to execute a custom tailorable code segment.
    It starts with some variable declarations and then several functions follow. The first function is called from the original application.
    Now I want to modify and debug it.

    Where / how shall I execute it?
    Your ideas would be greatly appreciated.

    Regards, Mathias



  • Hi Mathias,

    your question is kind of vague, I guess but I try to make a suggestion.

    Text {
        function testText(test){
            var testArray = test.split(',')
            var text = ''
            for(var i = 0; i < testArray.length; ++i){
                text += testArray[i]+'/'
            }
            text = text.slice(0, -1)
            return text
        }
        text:  testText(test)
    }
    

    I use this snipped in a ListView delegate. test is a variable from my model and will be passed through the JS function before it is displayed. The function testText does not need to be within Text, it could be in an external JS file.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.