Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. help with js and qml
Forum Updated to NodeBB v4.3 + New Features

help with js and qml

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 2 Posters 711 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.
  • mtaylorM Offline
    mtaylorM Offline
    mtaylor
    wrote on last edited by
    #1

    so i have a js function to get event data from an ics online calendar verified works
    i want to use this function to print that event in the clock.qml code as part of the lockscreen ui....

    so far i have this in the qml code
    import "/run/media/hammer/Data/projects/nat-day2.js" as NatDay
    ...
    Label {
    text: NatDay.nat_day()
    // text: "National Day"
    font.family: "Roboto"
    font.pointSize: 24
    Layout.alignment: Qt.AlignHCenter
    renderType: Text.QtRendering
    }

    nothing shows up, is it wrong? how do i test qml code to see errors?

    thanks

    ODБOïO 1 Reply Last reply
    0
    • mtaylorM mtaylor

      so i have a js function to get event data from an ics online calendar verified works
      i want to use this function to print that event in the clock.qml code as part of the lockscreen ui....

      so far i have this in the qml code
      import "/run/media/hammer/Data/projects/nat-day2.js" as NatDay
      ...
      Label {
      text: NatDay.nat_day()
      // text: "National Day"
      font.family: "Roboto"
      font.pointSize: 24
      Layout.alignment: Qt.AlignHCenter
      renderType: Text.QtRendering
      }

      nothing shows up, is it wrong? how do i test qml code to see errors?

      thanks

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      hi,
      try to see what NatDay.nat_day() returns

      Label {
      text: NatDay.nat_day()
      font.family: "Roboto"
      font.pointSize: 24
      Layout.alignment: Qt.AlignHCenter
      renderType: Text.QtRendering
      
      Component.onCompleted : {
         console.log(NatDay.nat_day())
      }
      
      }
      

      you can also use typeOf(e) js function to check the type

      1 Reply Last reply
      0
      • mtaylorM Offline
        mtaylorM Offline
        mtaylor
        wrote on last edited by
        #3

        this produces the desired result from the javascript file
        console.log(ev.summary)

        but nothing shows up when i run the qml code?

        ODБOïO 1 Reply Last reply
        0
        • mtaylorM mtaylor

          this produces the desired result from the javascript file
          console.log(ev.summary)

          but nothing shows up when i run the qml code?

          ODБOïO Offline
          ODБOïO Offline
          ODБOï
          wrote on last edited by ODБOï
          #4

          @mtaylor what is ev.summary ?
          can you show the js file and how you include it to you qml ?

          @mtaylor said in help with js and qml:

          nothing shows up

          make sure it is called somewhere

          1 Reply Last reply
          0
          • mtaylorM Offline
            mtaylorM Offline
            mtaylor
            wrote on last edited by
            #5

            the original post shows the qml code, the import js and qml
            text: NatDay.nat_day()
            i have tried using the JS var directly but causes error

            here are the files used
            https://github.com/txhammer68/qml/blob/master/nat-day2.js
            https://github.com/txhammer68/qml/blob/master/Clock.qml

            1 Reply Last reply
            0
            • mtaylorM Offline
              mtaylorM Offline
              mtaylor
              wrote on last edited by
              #6

              is there an app to test qml code? to see the the output errors?
              i have qt creator but do not see the option for qml...
              i am novice at this, just like playing around with my system
              thanks

              ODБOïO 1 Reply Last reply
              0
              • mtaylorM mtaylor

                is there an app to test qml code? to see the the output errors?
                i have qt creator but do not see the option for qml...
                i am novice at this, just like playing around with my system
                thanks

                ODБOïO Offline
                ODБOïO Offline
                ODБOï
                wrote on last edited by ODБOï
                #7

                @mtaylor in qt creator there is a Application output tab

                @mtaylor said in help with js and qml:

                JS

                is it pure js or node js ?

                mtaylorM 1 Reply Last reply
                0
                • ODБOïO ODБOï

                  @mtaylor in qt creator there is a Application output tab

                  @mtaylor said in help with js and qml:

                  JS

                  is it pure js or node js ?

                  mtaylorM Offline
                  mtaylorM Offline
                  mtaylor
                  wrote on last edited by
                  #8

                  @lelev
                  using node with ical
                  i run it in console with node nat-day2.js

                  ODБOïO 1 Reply Last reply
                  0
                  • mtaylorM mtaylor

                    @lelev
                    using node with ical
                    i run it in console with node nat-day2.js

                    ODБOïO Offline
                    ODБOïO Offline
                    ODБOï
                    wrote on last edited by ODБOï
                    #9

                    you can not call node js code from qml directly.
                    you can use QProcess to run your scripts
                    or search on google how to integrate node js with qt (i have no exp in that)

                    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