NdefEditor: fix B2Qt cross-builds on Windows

The example was generating a qml module named NdefEditor and a binary
named ndefeditor. During the build, the build tools create a
subdirectory named after the qml module in the build dir. As a result,
on case-insensitive filesystems (i.e. on Windows) this was leading to a
linker error, because the linker failed to create a binary (since there
already was a directory with the same name).
The issue was only observed during cross-compilation, because native
binaries get the ".exe" suffix.

Fix it by renaming the qml module to NdefEditorModule.

Amends 115b4d947a.

Fixes: QTBUG-133788
Task-number: QTQAINFRA-6985
Pick-to: 6.9 6.9.0 6.8 6.8.3 6.5
Change-Id: I1187474b07fe7c676612e79064f56d6711984c72
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Ivan Solovev 2025-03-14 13:36:08 +01:00
parent a47eda27e0
commit b5a4074cd7
6 changed files with 8 additions and 8 deletions

View File

@ -33,7 +33,7 @@ qt_add_resources(ndefeditor "theme" FILES
)
qt_add_qml_module(ndefeditor
URI NdefEditor
URI NdefEditorModule
VERSION 1.0
QML_FILES
Main.qml

View File

@ -7,7 +7,7 @@ import QtQuick.Controls
import QtQuick.Dialogs
import QtQuick.Layouts
import NdefEditor
import NdefEditorModule
ApplicationWindow {
id: window

View File

@ -6,7 +6,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import NdefEditor
import NdefEditorModule
SwipeDelegate {
required property int index

View File

@ -16,7 +16,7 @@ int main(int argc, char *argv[])
QObject::connect(
&engine, &QQmlApplicationEngine::objectCreationFailed, &app,
[]() { QCoreApplication::exit(1); }, Qt::QueuedConnection);
engine.loadFromModule("NdefEditor", "Main");
engine.loadFromModule("NdefEditorModule", "Main");
return app.exec();
}

View File

@ -4,7 +4,7 @@
QT += nfc quick quickcontrols2
CONFIG += qmltypes
QML_IMPORT_NAME = NdefEditor
QML_IMPORT_NAME = NdefEditorModule
QML_IMPORT_MAJOR_VERSION = 1
TARGET = ndefeditor
@ -27,7 +27,7 @@ qml_resources.files = \
MainWindow.qml \
NdefRecordDelegate.qml
qml_resources.prefix = /qt/qml/NdefEditor
qml_resources.prefix = /qt/qml/NdefEditorModule
theme_resources.files = \
icons/ndefeditor/20x20@2/add.png \

View File

@ -1,5 +1,5 @@
module NdefEditor
prefer :/qt/qml/NdefEditor/
module NdefEditorModule
prefer :/qt/qml/NdefEditorModule/
Main 1.0 Main.qml
MainWindow 1.0 MainWindow.qml
NdefRecordDelegate 1.0 NdefRecordDelegate.qml