Jino
Jino

Reputation: 365

Error : "module "QtQuick.Controls" is not installed"

Getting this error while running my program. I searched the Internet to find QtQuick.Controls but couldn't get any resolution.
How can I install this?

Upvotes: 10

Views: 38906

Answers (6)

breathfidgeting
breathfidgeting

Reputation: 373

For a Qt 6 on Ubuntu, the fix is:

sudo apt -y install qml6-module-qtquick-controls

You might want to have other modules as well, e.g.:

sudo apt -y install qml6-module-qtqml-workerscript
sudo apt -y install qml6-module-qtquick-templates
sudo apt -y install qml6-module-qtquick-layouts

Upvotes: 4

Crystal
Crystal

Reputation: 75

For those getting this issue while static building with vcpkg and CMAKE, I followed these steps:

  1. .\vcpkg install qt5-quickcontrols:<target>

I was building statically on a x64 windows platform so my target was x64-windows-static, more info about the target flag here

  1. In my CMakeLists.txt, below target_link_libraries() I added:

qt5_import_qml_plugins(${PROJECT_NAME} INCLUDE Qt5::qtquickcontrolsplugin)

Upvotes: 1

Fatemeh Karimi
Fatemeh Karimi

Reputation: 987

this command fixed my problem.

sudo apt -y install qml-module-qtquick-controls

Upvotes: 6

rbaleksandar
rbaleksandar

Reputation: 9691

Here is another answer which covers my case since it's different from what the other two answers give as feedback.

I've built Qt 5.7 for the Raspberry Pi (Raspbian Jessie). From my notebook I transferred a simplistic QML-based project which worked there. However after building the project on my Pi and starting it (note that QML problems often don't show up when you compile and link stuff) I got that very same error. Obviously the version here was not an issue.

The problem was that for some reason I haven't built the qtquickcontrols and qtquickcontrols2 modules in the source tree of my Qt. Luckily I used an USB flash drive for storing the sources and also where I have build my Qt version from these so it was just a matter of cding inside the respective module directories, executing qmake followed by make -j4 (for faster building use parallel make) and finally make install.

Upvotes: 0

aeronbuchanan
aeronbuchanan

Reputation: 41

Another cause of this 'module "Qt*" is not installed' class of problems on Ubuntu at least is the environment variable LD_LIBRARY_PATH not being set. It should include the path to the lib directory of your Qt installation, e.g.

if [ "x$LD_LIBRARY_PATH" = "x" ]; then
    export LD_LIBRARY_PATH=/home/username/Qt5.4.1/5.4/gcc_64/lib
else
    export LD_LIBRARY_PATH=/home/username/Qt5.4.1/5.4/gcc_64/lib:$LD_LIBRARY_PATH
fi

Upvotes: 2

Gustavo Niemeyer
Gustavo Niemeyer

Reputation: 22991

You're likely using an old version of Qt. The QtQuick.Controls module was introduced in Qt 5.1:

Upvotes: 3

Related Questions