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 - TypeError
Forum Updated to NodeBB v4.3 + New Features

QML - TypeError

Scheduled Pinned Locked Moved QML and Qt Quick
12 Posts 3 Posters 14.3k 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.
  • F Offline
    F Offline
    FlyingFish
    wrote on last edited by
    #3

    Here:

        @if (typeof item.activationComplete != 'undefined') item.activationComplete();@
    

    and
    @if (typeof item.deactivationComplete != 'undefined') item.deactivationComplete();@

    I'm trying to imitate the ViewLoader QML of this project:

    "https://projects.developer.nokia.com/QMLRestaurantApp"

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

      Where definition of 'item' variable?
      if you can't be sure that item exists in thi place, you should rewrite this lines as:

      @if (typeof(item) != 'undefined' &&
      typeof(item.activationComplete) != 'undefined') item.activationComplete();
      @

      and

      @if (typeof(item) != 'undefined' &&
      typeof(item.deactivationComplete) != 'undefined') item.deactivationComplete();
      @

      --
      Vasiliy

      1 Reply Last reply
      0
      • F Offline
        F Offline
        FlyingFish
        wrote on last edited by
        #5

        I think this is what you're looking for:

        @Item {
        id: contentPane
        clip: true
        anchors {
        top: titleBar.bottom
        left: mainWindow.left
        right: naviBarVertical.left
        bottom: naviBarHorizontal.top
        }@

        and after that block I put this:

        @ ViewLoader {
        id: windowView
        viewSource: "windowView.qml"
        keepLoaded: true
        }@

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

          I' still not see object with name 'item'.

          --
          Vasiliy

          1 Reply Last reply
          0
          • F Offline
            F Offline
            FlyingFish
            wrote on last edited by
            #7

            I can't find it. :O

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

              [quote author="FlyingFish" date="1315745736"]I can't find it. :O[/quote]

              I think interpreter can't find it too :)

              Well... What object do you expect in this place?

              or show more your source code.

              --
              Vasiliy

              1 Reply Last reply
              0
              • F Offline
                F Offline
                FlyingFish
                wrote on last edited by
                #9

                What do you mean what object?

                @ function activationComplete() {
                Util.log("activationComplete");
                // if (typeof item.activationComplete != 'undefined') item.activationComplete();
                if (typeof(item) != 'undefined' &&
                typeof(item.activationComplete) != 'undefined') item.activationComplete();
                }

                function deactivationComplete() {
                    Util.log("deactivationComplete");
                //    if (typeof item.deactivationComplete != 'undefined') item.deactivationComplete();
                    if (typeof(item) != 'undefined' &&
                    typeof(item.activationComplete) != 'undefined') item.activationComplete();
                    if (!keepLoaded)
                        source = "";
                }@
                

                and that's basically it.

                1 Reply Last reply
                0
                • AlicemirrorA Offline
                  AlicemirrorA Offline
                  Alicemirror
                  wrote on last edited by
                  #10

                  What we need to see is your Item definition, else it is very difficult to contextualize your function.

                  BTW, a general advice when the type error happens is that it can depend by the fact that at the time you check for something on that objet it is not yet loaded completeley (this means that not all the properties are set.). Try to move your control functions in onComponent.completed: { } to be sure that the Item is really loaded as you expect in the QML document. Then see if the error happens again and share with us the Item definition.

                  Enrico Miglino (aka Alicemirror)
                  Balearic Dynamics
                  Islas Baleares, Ibiza (Spain)
                  www.balearicdynamics.com

                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    FlyingFish
                    wrote on last edited by
                    #11

                    My Item definition? I'm sorry, I'm not good with terms. I'm still a beginner. Did you mean the visual styles that I put?

                    1 Reply Last reply
                    0
                    • AlicemirrorA Offline
                      AlicemirrorA Offline
                      Alicemirror
                      wrote on last edited by
                      #12

                      I think that Vass meant correct.

                      [quote author="Vass" date="1315746660"][quote author="FlyingFish" date="1315745736"]I can't find it. :O[/quote]
                      I think interpreter can't find it too :)
                      Well... What object do you expect in this place?
                      or show more your source code.[/quote]

                      Please share your code where the example you wrote refers to.

                      BTW, you write in above:
                      @
                      [...]
                      typeof(item.activationComplete)
                      [...]
                      @

                      What is this item???

                      Enrico Miglino (aka Alicemirror)
                      Balearic Dynamics
                      Islas Baleares, Ibiza (Spain)
                      www.balearicdynamics.com

                      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