Solved Qt 5.11 - qmlRegisterType gives "module is not installed".
-
I am using qt 5.11
In main.cpp,
qmlegisterSingletonType(QUrl("qrc:/qml/Components/Style.qml"), "com.xxx.yyy.dev.devStyle", 1, 0, "devStyle");Now in main.qml, i am using
import com.xxx.yyy.dev.devStyle 1.0But it is throwing error qrc:/qml/MainNew.qml:4:1: module "com.xxx.yyy.dev.devStyle" is not installed
Please provide a solution to how to solve this issue.
Note : Same was working with qt 5.6. The issue is seen when qt version was upgraded to qt 5.11.
Similar post is available in https://forum.qt.io/topic/36849/qt-5-qmlregistertype-gives-module-is-not-installed
But not reply is seen for that also. -
.pro file
QT += widgets qml quick multimedia
CONFIG += c++11SOURCES += qtquick2applicationviewer/qtquick2applicationviewer.cpp
src/guidancemap.cpp
src/liftmodehelper.cpp \HEADERS += qtquick2applicationviewer/qtquick2applicationviewer.h
inc/guidancemap.h
inc/acuids.h
inc/liftmodehelper.h \INCLUDEPATH += qtquick2applicationviewer
CONFIG(release, debug|release) {
DEFINES+=QT_NO_DEBUG_OUTPUT
}LIBS += -ludev
TRANSLATIONS = i18n/tsdop_1.ts
i18n/tsdop_2.ts
i18n/tsdop_3.ts \include(updatelocalizations.pri)
Target binary name
TARGET = tsdop
Target installs
desktop {
scripts.files=testtools/scripts
} else {
scripts.files=scripts
}
scripts.path=/opt/ksp858/tsdopmain
configurations.files=configuration/*
configurations.path=/data/tsdop
target.path=/opt/ksp858/tsdopmain
localization.files=i18n
localization.files+=$${OUT_PWD}/i18n
localization.path=/opt/ksp858/tsdopmain
INSTALLS = target scripts configurations localizationAdditional import path used to resolve QML modules in Creator's code model
QML_IMPORT_PATH =
Get build version number from environment
buildversion=$$BUILD_VERSION
! isEmpty(buildversion) {
message("build-version is $$buildversion")
DEFINES+="TSDOP_APP_VERSION=\"$$buildversion\""
}buildid=$$BUILD_ID
! isEmpty(buildid) {
message("build-id is $$buildid")
DEFINES+="TSDOP_BUILD_ID=\"$$buildid\""
}SOURCES += src/main.cpp
src/tsdopcontroller.cpp
src/tsdopsettings.cpp \HEADERS +=
inc/tsdopplugininterface.h
inc/tsdopcontroller.h
inc/tsdopsettings.h \INCLUDEPATH += inc
QMAKE_RESOURCE_FLAGS += -no-compress
RESOURCES +=
Resources.qrc
Resources-fonts.qrcOTHER_FILES +=
terms.txt
scripts/*
configuration/*
qml/* \DISTFILES +=
qml/Grid/Grid.qml
qml/Grid/GridButton.qml
qml/Grid/ListButton.qml
qml/CommonPages/AddNewItemPage.qml
qml/MainNew.qml \ -
@parvathypb could you please post your .pro file, the qrc contents and also describe the subfolder layout of your project...
-
.pro file
QT += widgets qml quick multimedia
CONFIG += c++11SOURCES += qtquick2applicationviewer/qtquick2applicationviewer.cpp
src/guidancemap.cpp
src/liftmodehelper.cpp \HEADERS += qtquick2applicationviewer/qtquick2applicationviewer.h
inc/guidancemap.h
inc/acuids.h
inc/liftmodehelper.h \INCLUDEPATH += qtquick2applicationviewer
CONFIG(release, debug|release) {
DEFINES+=QT_NO_DEBUG_OUTPUT
}LIBS += -ludev
TRANSLATIONS = i18n/tsdop_1.ts
i18n/tsdop_2.ts
i18n/tsdop_3.ts \include(updatelocalizations.pri)
Target binary name
TARGET = tsdop
Target installs
desktop {
scripts.files=testtools/scripts
} else {
scripts.files=scripts
}
scripts.path=/opt/ksp858/tsdopmain
configurations.files=configuration/*
configurations.path=/data/tsdop
target.path=/opt/ksp858/tsdopmain
localization.files=i18n
localization.files+=$${OUT_PWD}/i18n
localization.path=/opt/ksp858/tsdopmain
INSTALLS = target scripts configurations localizationAdditional import path used to resolve QML modules in Creator's code model
QML_IMPORT_PATH =
Get build version number from environment
buildversion=$$BUILD_VERSION
! isEmpty(buildversion) {
message("build-version is $$buildversion")
DEFINES+="TSDOP_APP_VERSION=\"$$buildversion\""
}buildid=$$BUILD_ID
! isEmpty(buildid) {
message("build-id is $$buildid")
DEFINES+="TSDOP_BUILD_ID=\"$$buildid\""
}SOURCES += src/main.cpp
src/tsdopcontroller.cpp
src/tsdopsettings.cpp \HEADERS +=
inc/tsdopplugininterface.h
inc/tsdopcontroller.h
inc/tsdopsettings.h \INCLUDEPATH += inc
QMAKE_RESOURCE_FLAGS += -no-compress
RESOURCES +=
Resources.qrc
Resources-fonts.qrcOTHER_FILES +=
terms.txt
scripts/*
configuration/*
qml/* \DISTFILES +=
qml/Grid/Grid.qml
qml/Grid/GridButton.qml
qml/Grid/ListButton.qml
qml/CommonPages/AddNewItemPage.qml
qml/MainNew.qml \ -
- Just ensure that Styles.qml exist in the resource file
- qml element name should be start with Capital letter. Make it as DevStyle rather than devStyle.
-
Hi @dheerendra , Thanks for the reply.
Yes, your suggestion helped in solving the issue. The element name should start with Capital Letter. That was the issue and now when the qml element name changed to "DevStyle" , it is working perfectly.
But , I could not find any info on that it qt doc website that qml element name should start with capital letter. Then how we will know, this was the issue .