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. Registering custom type to use with qml/javascript
Forum Updated to NodeBB v4.3 + New Features

Registering custom type to use with qml/javascript

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 550 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.
  • P Offline
    P Offline
    Pylvain
    wrote on last edited by
    #1

    I have a custom class, i will name it MyClass here.
    I registered one object of MyClass to the QmlEngine with setContextProperty
    I can call all its methods that are Q_INVOKABLE, no problem.
    One method(that is Q_INVOKABLE), that I will call get() returns an Object of MyClass.
    I get the Error : Unknown Method return type : MyClass.
    MyClass is registered with the macro QML_ELEMENT, Q_OBJECT, and inherit QObject.
    I read the doc of course, but I can't figure out what I did wrong.

    Can someone with some experience in the matter tell me what's not right ?

    Thanks !

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Shazter
      wrote on last edited by
      #2

      Just for clarification.

      Which Qt Version do you use 5.15.0 or below?

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Pylvain
        wrote on last edited by
        #3

        I use 5.15

        P 1 Reply Last reply
        0
        • P Pylvain

          I use 5.15

          P Offline
          P Offline
          Pylvain
          wrote on last edited by
          #4

          I've posted the code in stackoverflow i you dont mind looking it up : https://stackoverflow.com/questions/62792225/register-custom-type-in-qt-with-qjsengine

          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