-
Notifications
You must be signed in to change notification settings - Fork 100
feat: add QQmlImageProviderBase #1430
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
base: main
Are you sure you want to change the base?
Changes from 5 commits
e091394
563c536
32f827f
ce1cbda
0323e27
e66959c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| // clang-format off | ||
| // SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> | ||
| // clang-format on | ||
| // SPDX-FileContributor: Andrew Hayzen <andrew.hayzen@kdab.com> | ||
| // | ||
| // SPDX-License-Identifier: MIT OR Apache-2.0 | ||
| #pragma once | ||
|
|
||
| // The definitions file is auto-generated by the build script | ||
| #include <cxx-qt-lib/definitions.h> | ||
|
|
||
| #ifdef CXX_QT_QML_FEATURE | ||
|
|
||
| #include <QtQml/QQmlImageProviderBase> | ||
|
|
||
| namespace rust { | ||
| namespace cxxqtlib1 { | ||
|
|
||
| using QQmlImageProviderBaseImageType = QQmlImageProviderBase::ImageType; | ||
|
|
||
| } | ||
| } | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // clang-format off | ||
| // SPDX-FileCopyrightText: 2025 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> | ||
| // clang-format on | ||
| // SPDX-FileContributor: Leon Matthes <leon.matthes@kdab.com> | ||
| // | ||
| // SPDX-License-Identifier: MIT OR Apache-2.0 | ||
| #pragma once | ||
|
|
||
| #include "qml/qqmlimageproviderbase.h" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // clang-format off | ||
| // SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> | ||
| // clang-format on | ||
| // SPDX-FileContributor: Andrew Hayzen <andrew.hayzen@kdab.com> | ||
| // | ||
| // SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
|
||
| #include "cxx-qt-lib/qqmlimageproviderbase.h" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #[cxx_qt::bridge] | ||
dphaldes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| mod ffi { | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove empty line :-) |
||
| #[repr(i32)] | ||
| #[namespace = "rust::cxxqtlib1"] | ||
| #[derive(Debug)] | ||
| enum QQmlImageProviderBaseImageType { | ||
| Invalid = 0, | ||
| Image, | ||
| Pixmap, | ||
| Texture, | ||
| ImageResponse, | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In Qt 5 these enums are slightly different either have a cfg like In Qt 5
In Qt 6
Note in Qt 5 there is a gap of no 3 :-) And do we need the Invalid = 0 ? As that is not defined on the Qt side ? |
||
|
|
||
| extern "C++Qt" { | ||
| include!("cxx-qt-lib/qqmlimageproviderbase.h"); | ||
|
|
||
| #[qobject] | ||
| type QQmlImageProviderBase; | ||
|
Comment on lines
+23
to
+24
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In Qt 5, this is just a normal class and does no inherit from QObject, so again might need a cfg block to have two different types if we want to make it work with Qt 5 |
||
| } | ||
|
|
||
| #[namespace = "rust::cxxqtlib1"] | ||
| unsafe extern "C++" { | ||
| type QQmlImageProviderBaseImageType; | ||
| } | ||
| } | ||
|
|
||
| pub use ffi::QQmlImageProviderBase; | ||
| pub use ffi::QQmlImageProviderBaseImageType; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should be on the QQmlEngine rather than the QQmlApplicationEngine (which inherits from the QQmlEngine)