How should I use the types and constants in the Qt Namespace? #890
-
I am trying to create a TableView model. The stumbling block here is the handling of what is used in C++ in the form of Qt::~. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Hi, thank you for taking the time to ask this question :) What you're probably looking for is an So for Qt::Orientation, you likely want something like this: #[cxx_qt::bridge(namespace="Qt")]
mod qt {
enum Orientation {
Horizontal,
Vertical,
}
unsafe extern "C++" {
include!(< Qt >);
type Orientation; // <---- this tells CXX that the enum shouldn't be a new type, but already exists in C++.
}
} Then you should be able to use |
Beta Was this translation helpful? Give feedback.
You'll need the enum to match the size in Qt, eg if it's a
std::int32_t
in C++ then you need to add#[repr(i32)]
as an attribute about the enum.So the following might work if it's a
std::int32_t