Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/qml_features/qml/images/images.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/images">
<file>red.png</file>
</qresource>
</RCC>
4 changes: 4 additions & 0 deletions examples/qml_features/qml/images/images.qrc.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileContributor: Andrew Hayzen <andrew.hayzen@kdab.com>

SPDX-License-Identifier: MIT OR Apache-2.0
Binary file added examples/qml_features/qml/images/red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions examples/qml_features/qml/images/red.png.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
SPDX-FileContributor: Andrew Hayzen <andrew.hayzen@kdab.com>

SPDX-License-Identifier: MIT OR Apache-2.0
2 changes: 2 additions & 0 deletions examples/qml_features/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ fn main() {
// Ensure that Quick module is linked, so that cargo test can work.
// In a CMake project this isn't required as the linking happens in CMake.
.qt_module("Quick")
// Import a Qt resource file
.qrc("../qml/images/images.qrc")
.with_opts(cxx_qt_lib_headers::build_opts())
.build();
}
Expand Down
35 changes: 35 additions & 0 deletions examples/qml_features/tests/tst_qrc.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
// SPDX-FileContributor: Andrew Hayzen <andrew.hayzen@kdab.com>
//
// SPDX-License-Identifier: MIT OR Apache-2.0
import QtQuick 2.12
import QtTest 1.12

TestCase {
name: "QrcTests"

Component {
id: componentImage

Image {

}
}

function test_image(data) {
const image = createTemporaryObject(componentImage, null, {
"source": data.source,
});

compare(image.status, data.status);
}

function test_image_data() {
return [
{
tag: "valid", source: "qrc:/images/red.png", status: Image.Ready,
tag: "invalid", source: "qrc:/images/invalid.png", status: Image.Error,
}
]
}
}