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

cxx-qt-lib: Add binding for QQmlApplicationEngine::addImageProvider #1142

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

redstrate
Copy link
Contributor

Upstreamed from the patch in #785, this adds a way to add image providers written in Rust to the QML engine.

Upstreamed from the patch in KDAB#785, this adds a way to add image
providers written in Rust to the QML engine.
@redstrate redstrate self-assigned this Dec 10, 2024
@redstrate
Copy link
Contributor Author

WIP, I would like to have some sort of example. Someone in the KDE community asked about this, so we should probably upstream the patch to cxx-qt.

@redstrate redstrate marked this pull request as draft December 10, 2024 02:12

/// Sets the provider to use for images requested via the image: url scheme, with host proveri_id. The QQmlEngine takes ownership of provider.
pub unsafe fn add_image_provider(self: Pin<&mut QQmlApplicationEngine>, provider_id: &QString, provider: QQmlImageProviderBasePointer) {
let ptr = match provider {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is another case where having up/down casting would help out #562 (something we hope for this cycle). As then the method could just support the QQmlImageProviderBase* and in Rust you do upcast_ptr() when calling the method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants