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. Import c++ type registered with qmlRegisterSingletonType
Forum Updated to NodeBB v4.3 + New Features

Import c++ type registered with qmlRegisterSingletonType

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

    Hi, i've declared a singleton class and registered in with
    @ qmlRegisterSingletonType<presbiopia>("MyClass", 1, 0, "Class",classProvider);@

    where classProvider simply return an instance of MyClass
    then in qml i declare

    @ import MyClass 1.0 @

    and it gives me error such QML module not found, but if i try to call Class.property of a property i declared works fine, even with methods. Just it gives me no hints.

    Already tried to clean and build the project.
    Just annoying i know, it works, but is there anyone who as encountered this.
    Thanks A lot!
    ICAP.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      maksim1979
      wrote on last edited by
      #2

      yep, the same for me. Qt Creator marks my import as an error but at the same time I'm able to run my application without any problems. But if I use qmlRegisterType instead of qmlRegisterSingletonType everything is ok.

      P.S.
      It's actually one of the reasons why I'm thinking about using ContextProperty instead of registring singelton http://qt-project.org/forums/viewthread/37707/

      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