Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5952

QML module not found (QtQuick) on a newly installed Qt6 on Ubuntu 22.04

$
0
0

I have just installed Qt6 on my Ubuntu 22.04:

sudo apt-get install qt6-base-dev qt6-declarative-dev qt6-base-dev qtcreator

I've opened qtcreator and created a new Qt Quick Application with the default code:

main.cpp

#include <QGuiApplication>#include <QQmlApplicationEngine>int main(int argc, char *argv[]){#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);#endif    QGuiApplication app(argc, argv);    QQmlApplicationEngine engine;    const QUrl url(QStringLiteral("qrc:/main.qml"));    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,&app, [url](QObject *obj, const QUrl &objUrl) {        if (!obj && url == objUrl)            QCoreApplication::exit(-1);    }, Qt::QueuedConnection);    engine.load(url);    return app.exec();}

main.qml

import QtQuick 2.15 *QML module not found (QtQuick).*import QtQuick.Window 2.15 *QML module not found (QtQuick.Window).*Window {    width: 640    height: 480    visible: true    title: qsTr("Hello World")}

And the following compilation errors:

09:14:30: Starting /home/myself/build-qttest-Desktop-Debug/qttest...QML debugging is enabled. Only use this in a safe environment.Warning: Ignoring WAYLAND_DISPLAY on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.QQmlApplicationEngine failed to load componentqrc:/main.qml:2:1: module "QtQuick.Window" is not installedqrc:/main.qml:1:1: module "QtQuick" is not installedqrc:/main.qml:2:1: module "QtQuick.Window" is not installedqrc:/main.qml:1:1: module "QtQuick" is not installed09:14:30: /home/myself/build-qttest-Desktop-Debug/qttest exited with code 255

Here are my libraries:

$  dpkg --get-selections | grep libqtlibqt5concurrent5:amd64             installlibqt5core5a:amd64              installlibqt5dbus5:amd64               installlibqt5designer5:amd64               installlibqt5designercomponents5:amd64         installlibqt5gui5:amd64                installlibqt5help5:amd64               installlibqt5network5:amd64                installlibqt5positioning5:amd64            installlibqt5printsupport5:amd64           installlibqt5qml5:amd64                installlibqt5qmlmodels5:amd64              installlibqt5qmlworkerscript5:amd64            installlibqt5quick5:amd64              installlibqt5quicktest5:amd64              installlibqt5quickwidgets5:amd64           installlibqt5sensors5:amd64                installlibqt5serialport5:amd64             installlibqt5sql5:amd64                installlibqt5sql5-sqlite:amd64             installlibqt5svg5:amd64                installlibqt5test5:amd64               installlibqt5webchannel5:amd64             installlibqt5webkit5:amd64             installlibqt5widgets5:amd64                installlibqt5xml5:amd64                installlibqt5xmlpatterns5:amd64            installlibqt6concurrent6:amd64             installlibqt6core6:amd64               installlibqt6dbus6:amd64               installlibqt6gui6:amd64                installlibqt6labsanimation6:amd64          installlibqt6labsfolderlistmodel6:amd64        installlibqt6labsqmlmodels6:amd64          installlibqt6labssettings6:amd64           installlibqt6labssharedimage6:amd64            installlibqt6labswavefrontmesh6:amd64          installlibqt6network6:amd64                installlibqt6opengl6:amd64             installlibqt6opengl6-dev:amd64             installlibqt6openglwidgets6:amd64          installlibqt6printsupport6:amd64           installlibqt6qml6:amd64                installlibqt6qmlcore6:amd64                installlibqt6qmllocalstorage6:amd64            installlibqt6qmlmodels6:amd64              installlibqt6qmlworkerscript6:amd64            installlibqt6qmlxmllistmodel6:amd64            installlibqt6quick6:amd64              installlibqt6quickcontrols2-6:amd64            installlibqt6quickcontrols2impl6:amd64         installlibqt6quickdialogs2-6:amd64         installlibqt6quickdialogs2quickimpl6:amd64     installlibqt6quickdialogs2utils6:amd64         installlibqt6quicklayouts6:amd64           installlibqt6quickparticles6:amd64         installlibqt6quickshapes6:amd64            installlibqt6quicktemplates2-6:amd64           installlibqt6quicktest6:amd64              installlibqt6quickwidgets6:amd64           installlibqt6sql6:amd64                installlibqt6sql6-sqlite:amd64             installlibqt6test6:amd64               installlibqt6widgets6:amd64                installlibqt6xml6:amd64                install

How to fix the error and compile it?


Viewing all articles
Browse latest Browse all 5952

Trending Articles