Skip to content

Need to be able to choose the parent when deriving from different bases #474

Closed
@ahayzen-kdab

Description

@ahayzen-kdab

Currently we assume that it'll be QObject* parent = nullptr, but for some Qt types (eg QQuickPaintedItem or QQuickItem) the parent is different.

We need to have a way in the cxx_qt::qobject macro to be able to specify a different parent other than QObject.

There seems to be these options

  • If we can assume all parent types will be a raw pointer then just have #[cxx_qt::qobject(base = "QQuickPaintedItem", parent = "QQuickItem"]
  • If we can't assume this then we might need something like #[cxx_qt::qobject(base = "QQuickPaintedItem", parent_ptr = "QQuickItem"] or #[cxx_qt::qobject(base = "QQuickPaintedItem", parent = "QQuickItem*", parent_default = "nullptr"]
  • Have a separate macro for items that aren't directly derived from QObject, eg have #[cxx_qt::qquickitem(base = "QQuickPaintedItem")] this then means that we can generate the different asserts and parent etc and it's clear to the developer which base the type is deriving from

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions