-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider how to support enums through to QML #34
Comments
Now you can define an enum in CXX, then register that enum to QML manually in C++. |
Right, CXX takes care of most of the work already. But it would be helpful to be able to add a |
I need to try this again but i almost got it working before using |
Related to KDAB#34
Related to KDAB#34
We should be able to support both e.g.: #pragma once
#include <cstdint>
struct MyObject {
enum class MyEnum : std::int8_t { A, B };
};
namespace rust {
namespace MyObject {
using MyEnum = ::MyObject::MyEnum;
}
} // namespace rust #[cxx::bridge]
pub mod ffi {
#[cxx_name = "MyEnum"]
#[namespace = "rust::MyObject"]
enum MyEnum {
A,
B,
}
unsafe extern "C++" {
include!("src/myobject.h");
#[cxx_name = "MyEnum"]
#[namespace = "rust::MyObject"]
type MyEnum;
}
} Then we would support these two kinds of declarations: #[qenum]
#[namespace="MyNamespace"]
enum MyEnum { ... } #[qenum(MyObject)]
enum MyEnum { ... }
extern "RustQt" {
type MyObject = ...;
} |
It turns out we can use QML_ELEMENT with Q_NAMESPACE to expose a Q_ENUM_NS it to QML. |
This is the initial support for KDAB#34. It only supports `Q_ENUM` within a given `Q_OBJECT` class. `Q_ENUM_NS` is not (yet) supported. Documentation will be added in a follow-up commit.
This is the initial support for KDAB#34. It only supports `Q_ENUM` within a given `Q_OBJECT` class. `Q_ENUM_NS` is not (yet) supported. Documentation will be added in a follow-up commit.
This is the initial support for KDAB#34. It only supports `Q_ENUM` within a given `Q_OBJECT` class. `Q_ENUM_NS` is not (yet) supported. Documentation will be added in a follow-up commit.
This is the initial support for KDAB#34. It only supports `Q_ENUM` within a given `Q_OBJECT` class. `Q_ENUM_NS` is not (yet) supported. Documentation will be added in a follow-up commit.
This is the initial support for KDAB#34. It only supports `Q_ENUM` within a given `Q_OBJECT` class. `Q_ENUM_NS` is not (yet) supported. Documentation will be added in a follow-up commit.
This is the initial support for KDAB#34. It only supports `Q_ENUM` within a given `Q_OBJECT` class. `Q_ENUM_NS` is not (yet) supported. Documentation will be added in a follow-up commit.
This is the initial support for #34. It only supports `Q_ENUM` within a given `Q_OBJECT` class. `Q_ENUM_NS` is not (yet) supported. Documentation will be added in a follow-up commit.
Done |
This is done. |
We need to support enums to allow for complex objects like QAbstractListModel etc.
The text was updated successfully, but these errors were encountered: