Qml javascript problem



  • hi I am trying to integrate javascript with QML from doc.qt.nokia.com. The problem is when i run the same code in windows 7 then it does not display factorial when i click on the MouseArea but when i run the same code in ubuntu it works fine.

    here is the code
    @
    import Qt 4.7

    Rectangle {
    width: 200
    height: 200

    function factorial(a) {
        a = parseInt(a);
        if(a <= 0)
            return 1;
        else
            return a * factorial(a-1);
    }
    
    MouseArea {
        anchors.fill: parent
        onClicked: console.log(factorial(10))
    }
    

    }
    @

    help please



  • can someone tell me why is it not running on windows??



  • [quote author="doforumda" date="1293008811"]hi I am trying to integrate javascript with QML from doc.qt.nokia.com. The problem is when i run the same code in windows 7 then it does display factorial when i click on the MouseArea but when i run the same code in ubuntu it works fine.

    here is the code
    @
    import Qt 4.7

    Rectangle {
    width: 200
    height: 200

    function factorial(a) {
        a = parseInt(a);
        if(a <= 0)
            return 1;
        else
            return a * factorial(a-1);
    }
    
    MouseArea {
        anchors.fill: parent
        onClicked: console.log(factorial(10))
    }
    

    }
    @

    help please[/quote]

    Where is the problem then if it works fine on ubuntu and Windows 7.



  • on WINDOWS it DOES NOT work but on ubuntu it works



  • sorry i forgot to write "NOT" in above main(first) post.



  • Please, show Error message or console output under Windows 7



  • Hi,

    This is likely due to the differences in console output settings between platforms. If you control the project file of your project, try adding

    @
    CONFIG += console
    @

    to your .pro file. If you are using qmlviewer, you can try experimenting with the "Warnings" options under the "Settings" menu.

    Regards,
    Michael



  • Are you using qmlviewer binary to run the qml file.



  • Thanks guys it's working


Log in to reply
 

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