Skip to content
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

QGraphicsScene&QGraphicsview support #720

Open
tiny911 opened this issue Oct 31, 2023 · 1 comment
Open

QGraphicsScene&QGraphicsview support #720

tiny911 opened this issue Oct 31, 2023 · 1 comment
Labels
🤔 discussion Feedback welcome ⬆️ feature New feature or request

Comments

@tiny911
Copy link

tiny911 commented Oct 31, 2023

I was wondering if there were any plans to support QGraphicsScene QGraphicsview, if so any idea when we can expect the crate to support it?

@ahayzen-kdab
Copy link
Collaborator

Thanks for taking the time to report this issue.

Our plans are initially to make it easier for developers themselves to express a binding using a CXX-Qt bridge to an existing Qt type, then once we have rearranged things internally we can start looking at wrapping more types in cxx-qt-lib.

The idea for 0.6 is that you should be able to write the following and then use the ffi::QPushButton type, in theory the same could be used for QGraphicsScene / QGraphicsView.

#[cxxqt::bridge]
mod ffi {
    extern "C++Qt" {
        include!(<QPushButton>);
        type QPushButton;

        #[rust_name = "set_text"]
        fn setText(self: Pin<&mut QPushButton>, text: &QString);

        #[qsignal]
        fn clicked(self: &QPushButton, bool checked);
    }
}

Note however that a lot of the QtWidgets API uses raw pointers, which means with CXX this becomes unsafe API. Constructors either need to use the helper in cxx-qt-lib or your own C++ trampoline. And we also need to wrap a few more useful types like quintptr etc. I think in the 0.7 and 0.8 cycles we should explore how to improve this.

@ahayzen-kdab ahayzen-kdab added ⬆️ feature New feature or request 🤔 discussion Feedback welcome labels Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤔 discussion Feedback welcome ⬆️ feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants