Skip to content

Explore how we would define a Q_GADGET #352

Open
@ahayzen-kdab

Description

@ahayzen-kdab

The main difference is that a gadget doesn't derive from a QObject and doesn't have any signals or slots

https://doc.qt.io/qt-6/qobject.html#Q_GADGET

Areas that would need API / changes

  • cxx_qt::qobject we would need a cxx_qt::qgadget macro too
  • Inside the struct when there are qproperty there should be no NOTIFY
  • There should be no cxx_qt::qsignals(T) where T is a gadget
  • What should happen to the qobject::T naming for both the "C++" context and the impl qobject::T ? should we have a qgadget::T ? or instead change things to something more generic like qt::T or cpp::T or cxx_qt::T ?
  • What happens with the threading ? We use QMetaObject::invokeMethod(QObject* ptr, ... ) so this would need to be disabled ?
  • We need to change our QObject assert to ensure it does not derive from a QObject ?
  • Should you be able to still define custom base classes?
  • Consider support for Q_GADGET-only features (e.g. QML_VALUE_TYPE)

Metadata

Metadata

Assignees

No one assigned

    Labels

    ⬆️ featureNew feature or request🤔 discussionFeedback welcome🥳🎉 1.0This issue is part of stabilization for 1.0 release

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions