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.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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::~.
For example, Qt::Orientation used as a headerData argument is not a type in cxx_qt_lib, but I don't know how to use it. I tried to create an enum called Orientation with reference to the sample custom_base_class.rs Role, but I get an error saying
cannot convert 'Orientation' to 'Qt::Orientation'
.Or something like Qt::DisplayRole, I know it can be represented as a number, but is there a way to use it as a constant?
Sorry if this is an oversight or misunderstanding, but I would appreciate your help.
Beta Was this translation helpful? Give feedback.
All reactions