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. declare property of non-createble C++ type
Forum Updated to NodeBB v4.3 + New Features

declare property of non-createble C++ type

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 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.
  • R Offline
    R Offline
    Rem-Kolomna
    wrote on last edited by
    #1

    I expose my C++ object into qml using function:
    qmlRegisterUncreatableType<MyObj>("myapp", 1, 0, "MyObj", "");

    This object can not be created directly, but returned from other functions. Like this:

    property var obj;
    ...
    obj = test.getMyObj();
    

    I'm trying to declare property type (to get context help)

    property MyObj obj: undefined
    

    but get qml error "Element is not creatable."

    Is it possible to declare property of non-createble C++ type?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rem-Kolomna
      wrote on last edited by
      #2

      Duplicate. As I can see here https://forum.qt.io/topic/25200/using-non-creatable-type-in-qml it isn't possible. But I don't understand why the way qml initialize objects makes this thing impossible.

      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