Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qml javascript function arguments lost on 5.2
QtWS25 Last Chance

Qml javascript function arguments lost on 5.2

Scheduled Pinned Locked Moved Mobile and Embedded
11 Posts 3 Posters 2.9k Views
  • 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.
  • O Offline
    O Offline
    onek24
    wrote on last edited by
    #2

    Hello and welcome to qt-project.org,

    i have tried it using Qt 5.2.1 and it worked fine. It is probably a bug in 5.2.0 so i would recommend you to report it and to update up to 5.2.1.

    "Bugreport":https://bugreports.qt-project.org/issues/?jql=

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tha001
      wrote on last edited by
      #3

      I have the same problem 5.2.1. It has not worked since beta1.

      Thanks for the welcome.

      1 Reply Last reply
      0
      • O Offline
        O Offline
        onek24
        wrote on last edited by
        #4

        You have the same problem in 5.2.1? Which Viewer are you using to display your QML? And could you please post the console output using this code:
        @import QtQuick 2.0

        Item {
        function func(halfHours) {
        return halfHours
        }
        function funcTwo(halfHours) {
        var temp = [halfHours]
        return temp.toString()
        }

        Component.onCompleted: {
            console.log(func(444))
            console.log("String and " + func(555))
            console.log("String and " + func("String"))
            console.log("String and " + func(0.1))
            var number = func(666)
            console.log("String and " + number)
            console.log("String and " + funcTwo(777))
        }
        

        }@

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tha001
          wrote on last edited by
          #5

          I use a custom viewer. The results are:
          784 18:42:26.144 qml-launcher(289) None: 0
          785 18:42:26.145 qml-launcher(289) None: String and 0
          786 18:42:26.145 qml-launcher(289) None: String and 0
          787 18:42:26.145 qml-launcher(289) None: String and 0
          788 18:42:26.146 qml-launcher(289) None: String and 0
          789 18:42:26.146 qml-launcher(289) None: String and 0

          1 Reply Last reply
          0
          • O Offline
            O Offline
            onek24
            wrote on last edited by
            #6

            Then the problem should be your custom viewer. Would you mind trying the samplecode i posted with a QQuickView?

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tha001
              wrote on last edited by
              #7

              I guess i used the wrong terminology. I use a custom application that works fine on qt 5.0. For some reason qmlscene crashes due to a seg fault i 5.2.1.
              I do like this.

              @QGuiApplication app(argc, argv);
              QuickView View;
              View.setResizeMode(QQuickView::SizeRootObjectToView);
              View.setGeometry(0, 0, 1280, 720);
              View.setSource(QUrl(QString::fromLatin1(uri.c_str())));
              View.show();@

              1 Reply Last reply
              0
              • O Offline
                O Offline
                onek24
                wrote on last edited by
                #8

                Your code looks all okay so far, but why are you using QString::fromlatin1 for your source?

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  tha001
                  wrote on last edited by
                  #9

                  That looks a bit bad, but do you think this will cause my problem?

                  Any idea how to proceed?

                  1 Reply Last reply
                  0
                  • O Offline
                    O Offline
                    onek24
                    wrote on last edited by
                    #10

                    I would highly guess that your problem is in your QuickView. Would you mind posting it's code so i can check it out?

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      juba
                      wrote on last edited by
                      #11

                      We also have the same issue but after a few scope name changes (I mean: use some property with extended dot notation inside the same qml file) our applications worked well on desktop.
                      Our BIG issue is that the target of this application is the i.MX6 board and on that platform (using the same version of Qt 5.2.1 compiled following the freescale guidelines) the application still have strange behaviour and thousands of runtime warnings/errors regarding javascript and in particular string variables.
                      I think that this happens because in Qt 5.2 javascript has moved to V4 and in this cross compilation environment we use the linaro toolchain gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12 .
                      Anyone have experienced the same problem?

                      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