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. Reference Errors
Qt 6.11 is out! See what's new in the release blog

Reference Errors

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 630 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.
  • M Offline
    M Offline
    maxwell31
    wrote on last edited by
    #1

    Hi,

    I have the following problem: I get the following errors at startup of my QML application:

          qrc:/CustomScreen.qml:14:5: QML Connections: Cannot assign to non-existent property "onCustomSignal"
         qrc:/CustomScreen2.qml:15: ReferenceError: customObject is not defined
         qrc:/CustomScreen3.qml:54: ReferenceError: customModel is not defined
    

    I suppose this happens because I set these properties from C++ only after the application start. What is the correct way of dealing with things, e.g. a model which only get created during the application?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You need to initialize the model before you load your QML files - with some default / empty values if you don't yet have the "proper" ones. Then QML engine won't complain.

      Alternatively, you can defer loading the CustomScreenX components by using a Loader (or Qt.createComponent()) and only load them when your data is ready.

      (Z(:^

      1 Reply Last reply
      1

      • Login

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