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. Alias of Alias
QtWS25 Last Chance

Alias of Alias

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 2 Posters 1.2k 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.
  • T Offline
    T Offline
    TonyN
    wrote on last edited by
    #1

    I have a ListView inside a component, let call this comp1. comp1 is used in another separate component, comp2. comp2 is again inside a separate Window, window1. Now, when I use window1, I want to assign the model of my ListView, from outside of window1. I was using alias referencing another alias throughout this multiple level of nesting, but I got an error "Invalid alias location". After look around, the document of Qt clearly state "Likewise, aliasing an aliasing property will also result in an error."

    So how do I solve this problem?

    Note: I can get away with this using alias reference entire ListView. The app run fine with expected behaviors, even the QML editor give error say the comp2 "does not have members" (it could be another unrelated error)

    Thanks

    1 Reply Last reply
    0
    • T Offline
      T Offline
      TonyN
      wrote on last edited by
      #2

      OK, it was the end of the day last night, so I may have made some mistake. This morning, I wonder why I can still make aliases of alias of the ListView... so I rewrite the code again, and I don't get the "Invalid alias location" anymore with the aliases of alias of the ListView's model, but now the model I assign to my model alias at the window1 seem have effect (the ListView shows nothing).

      The aliases to alias of ListView still work fine; however, I am uncomfortable with expose entire ListView, especially through multitple level...

      So any suggestion?

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

        I rename the aliases and it all working now!! Duh!

        1 Reply Last reply
        0
        • L Offline
          L Offline
          literA2
          wrote on last edited by literA2
          #4

          Hi @TonyN i'm encountering the same error also. In my case, i am aliasing the text property. In component1, i have a Loader which loads the textfield, in sourceComponent I used alias for the text property (property alias text: textField.text), then use another alias to expose it outside of component1 (property alias txt: loader.item.text). When I use the component1 into a qml page, i encountered this "Invalid alias location."

          Please advice. Thanks

          EDIT: I resolved this issue using loader item alias in component1 (property alias loderItem: loader.item)

          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