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. Usage of abstract base class registered in QML

Usage of abstract base class registered in QML

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

    I've have a Q_OBJECT derived C++ base class, which is registered with QML using qmlRegisterType. This registered type is a property of a QML item, which defaults to null, like so:

    Item {
    
        id: root
        property QtBaseClass implementation: null
    

    In turn, there are many QML Items that contain this QML item. Each of them sets the propertyimplementation to an instance of a class derived from QtBaseClass.

    QtBaseClass itself has no useful function definitions, so I'd like to make it abstract. However, if I make it abstract and register it with qmlRegisterInterface or qmlRegisterUncreatableType, I can't use it as a QML property in this way, even if it is set to null.

    What is the intended method to accomplish what I'm doing?

    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