Search code examples
c++qtqt5qtquickcontrols

Qt found not working imports, but project is working. Partially


I want to build simple Qt Quick application that access filesystem and do some work with files. But Qt Creator behaves strangely.

I used Qt Designer and added a couple of elements in window

Project canvas

Yellow ! sign says: designer warning

But project compiles and runs succesfully. Also i need imports like QtQuick.Dialogs which is imported too, but they do not appear in Designer at all.

I think the reason might be case i described in my answer to own question, but i cannot understand how Maintenance Tool did not install everything.

Maybe i forgot something to check?

I run Ubuntu 16 LTS and use

Qt 5.13.0 and Qt Creator 4.9.2

Qt Maintenance tool


Solution

  • I think you have a Typo in the version number of your import line. Be aware that not all QML modules follow the version numbers of Qt. It's not because you installed Qt5.13 that you will need "import QtQuick.Controls 2.13" You can even use lower version numbers to make your code usable for people with older versions of Qt.

    I'm currently on Qt 5.12 LTS and can't check if QtQuick.Controls 2.13 exists. But there is an easy way for you to find out yourself: Go to the import line in the QML file, put the cursor behind the 2. and type CTRL+SPACEBAR All available versions will show up. Pick one that is available and you should be good to go.