Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qml javascript problem
Forum Updated to NodeBB v4.3 + New Features

Qml javascript problem

Scheduled Pinned Locked Moved QML and Qt Quick
9 Posts 4 Posters 4.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    doforumda
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • D Offline
      D Offline
      doforumda
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kamalakshantv
        wrote on last edited by
        #3

        [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.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          doforumda
          wrote on last edited by
          #4

          on WINDOWS it DOES NOT work but on ubuntu it works

          1 Reply Last reply
          0
          • D Offline
            D Offline
            doforumda
            wrote on last edited by
            #5

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

            1 Reply Last reply
            0
            • V Offline
              V Offline
              vsorokin
              wrote on last edited by
              #6

              Please, show Error message or console output under Windows 7

              --
              Vasiliy

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mbrasser
                wrote on last edited by
                #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

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  kamalakshantv
                  wrote on last edited by
                  #8

                  Are you using qmlviewer binary to run the qml file.

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    doforumda
                    wrote on last edited by
                    #9

                    Thanks guys it's working

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved