Qt6 imports with qtcreator 4.13+ - qt

Qt6 supports importing QML modules without specifying the version number.
Example:
Qt5: import QtQuick 2.0
Qt6: import QtQuick
where Qt6 will just choose the newest version of the module.
My problem is, that the current version of qtcreator does not seem to know about this feature (or any Qt6 features, most likely). I get the following error:
Opening the Designer with this error present, results in an error message telling me, that the QML code is broken. Running the project works flawlessly. I work on Arch Linux and installed the whole qt6 group as well as pyside6 and the install was successful. I tried to add Qt6 functionality by choosing /usr/bin/qmake-qt6 under Tools > Options > Kits > Qt Versions > Add, but this did not change anything, which does not seem surprising to me, but I thought I would try.
Is anyone else facing this problem? Have I overseen something? Can I maybe select another QML linter in an option I did not see?
Any help will be very much appreciated, I will continue to work with hardcoded version numbers for now, but I really like this new feature.

Related

import Qt5Compat.GraphicalEffects: QML module not found

I am on Arch Linux and I am trying to use PySide6 and QT6 in my project since I will need to be able to use singleton qml objects and PySide2 doesn't seem to support the registration of singleton qml objects. My project uses ColorOverlays and DropShadows, so I will need GraphicalEffects support. However, according to the doc pages, these aren't supported by Qt6 and require a compatibility module, Qt5Compat.GraphicalEffects to be supported.
I am trying to import Qt5Compat.GraphicalEffects into my QML code via the import statement below:
import Qt5Compat.GraphicalEffects
However, when I add this to my project's QML in QT Creator, I am getting the error: "QML module not found."
Here are some things I have tried in order to remedy this issue:
Installed QT using the installer from the website.
Installed Qt6/5 via pacman.
Installed the qt6-5compat package from the AUR.
Installed qt6/5-base from the AUR.
Googling the issue.
How can I fix this issue with importing Qt5Compat.GraphicalEffects?
EDIT:
I am using Python and PySide6 for my backend code, but I am writing the front-end in QML, which is where I am having my issue.
Here could be the solution for the problem.
From the main directory "QT" you need to take the Qt5Compad module. This must be added to the development environment.
It works with Pyside6 and PyQT6.
Here is a better description: QT6.4 QML PYTHON module "Qt5Compat.GraphicalEffects" is not installed
You have to keep in mind that PySide2 is a binding of Qt5 and PySide6 is that of Qt6.
If you want to use ColorOverlay or DropShadow with pyside2 then you should follow the Qt5 documentation that says you should use import QtGraphicalEffects 1.15.
If instead you want to use it in pyside6 it has moved those components to the Qt5Compat module so you should use: import Qt5Compat.GraphicalEffects.
So the way to import will depend on whether you are using PySide2 (Qt5) or PySide6 (Qt6).
Note: QtCreator does not have many capabilities so many times it will throw false positives since it is not able to understand PySide. Unfortunately they have not given it "much affection" so it is not optimized to work with python obtaining that type of warnings. So just obviate the warning.

Qtquick - QML Module not found

I am getting started with qt and especially qt quick now and wanted to do the example from here: https://doc.qt.io/qt-5/qtquick3d-simple-example.html
However already the line import QtQuick3D 1.15 has been giving me headaches. The error that is printed says QML Module not found (QtQuick3D). If I am trying to import other things, I get the corresponding errors.
The error message also tells me "for qmake projects use the QML_IMPORT_PATH variable to add import paths" however I don't know what path and how I should set this?
Another solution I have seen is the one suggested here: https://stackoverflow.com/a/64952178/13533641.
Again I am unsure which path to add here. I tried "/usr/lib/qt5/bin" and "/home/Qt/5.15.2/gcc_64/bin". After setting the value I restarted Qt Creator but the error remained.
The project I have been using is an empty QT Quick application which you get if you create a new project. I just added that one import line.
I have used the Mainainance Tools to check the plugins and I installed something that was named 3D. I am unsure if this is the "normal" qtwidget thing or the one I am trying to use in the code. (Or maybe there is no difference anyway, who knows)
I use qt version 5.15 right now but I also tried installing the 5.9 and 6. Everywhere I have the same problem.
My machine runs ubuntu 20.04 and I installed qt using the official download for linux.
If I am correct, it got installed in the directory /home/Qt.
Does anybody know how to solve this?
After trying different paths and versions of Qt, I found this this instruction here
However I only needed to follow until the picture of the mainaintance tool and not the building afterwards. Before I had already added the additional library for Qt3d. This enough wasn't enough apparently, after adding the Qt-shader tools it and conan it worked however.
I did this after yet another fresh installation of Qt (this time version 6) and it worked now.
Regarding the suggested change for the qml emulation layer: the path that is now set is /home/Qt/5.15.2/gcc_64/bin.
Hope this helps someone in the future!

Qt 5.9.0 to 5.9.4 work fine, but Qt 5.9.5 and 5.9.6 have issues

I'm playing around with this repo: https://github.com/qt-labs/qt3d-editor
My observation:
When using Qt 5.9.0, 5.9.1, 5.9.2, 5.9.3 and 5.9.4, the application can import files, like STL.
But with Qt 5.9.5 and 5.9.6 the application cannot import any file, it gets stuck in import process and never finishes importing. Also, the same issue happens when working with Qt 5.11.
I assume it might be related to Qt3D module. The 5.9.5 change log for Qt3D mentions that only minor code improvements are done. Can anybody give a hint why this is happening?
The screen shot of import button getting stuck is shown below:
Tested with Qt 5.11.2 and it works fine. Take a look at this:
Importing objects in Qt3D doesn't work but there's not error message

No qmlviewer installed

I've installed Qt SDK 5.0.0 beta 2 and Qt Creator 2.6.0. It detects the package but gives a warning that "No qmlviewer installed". I've looked for it and it is in the SDK bin folder. What can I do? I use ubuntu 12.04 and I've added the SDK binaries to the PATH. I can view the QML files through the terminal.
It is not a solution but maybe it will be helpful.
I can see this warning too, but I think it is not a big problem. I have started to move my existing Quick1 code to new Qt version and I have not seen Qt5 Kit in the drop down list. But when I have created new Quick2 application I found it. And everything seems to work without QMLviewer.
Btw, I found forum post about Qt5 and qmlveiwer. Guy says that it was very difficult to support viewer in the actual state because API of declarative modules are changing very quickly. So they have dropped qmlviewer from Qt5.

Problem installing QT on Vista

I have downloaded QT SDK LGLP (Creator + libraries) 4.6 and I am having problems compiling projects. After install I have added C:\Qt\2010.02\qt;C:\Qt\2010.02\qt\bin to PATH and added QTDIR env varaible containing C:\Qt\2010.02\qt, the I run "configure -platform win32-g++" to compile it. Everything went good.
I the tried to use QT Creator to create and compile a project.
The problem is everytime I try to compile I get the following error message:
No valid Qt version set. Set one in Tools/Options
Error while building project GUITest
When executing build step 'QMake'
Canceled build.
When I go to Tools/Options the manual version is set to v4.6.2, Location c:\qt\2010.02\qt\bin\qmake.exe. The auto detected version is set to even though I have added the dirs in Path. Is there something I am doing wrong here? Has anyone encountered this problem in Vista.
I have been working on this for 2 days, change configurations, reinstalled etc...
The QtDir value is compiled into the
qmake-binary. You can only change this
by recompiling qmake and passing on a
different value to qt-configure (I'm
not sure which setting or variable is
passed on to qmake) When using
precompiled, downloaded binaries,
you'll have to keep the QtDir at
c:\Qt\4.6.2
EDIT:
What I said was incorrect. The locations of qmake, moc,... are located in the file:
<Qt>/4.x.x/.qmake.cache
Try uninstalling/reinstalling qt creator
But i highly suspect you didnt compile qt properly as this problem seems really odd. I had alot of problems compiling so i know myself from the past mistakes.
Make sure you carefully reread install instructions for your environment, also if you have visual studio you need to follow procedure to install it in compliance with it. Same if you use another c compiler
If nothing goes right, the easiest way to install qt imo is directy from their git hub, chec installin qt from git, on their git site there is wiki that explains how to do it
its really easy and after that all you need to do is add the qt to creator
Hey, it QT emulators have lot of problems in vista, i have tried several times,it didnt work for me.. it works well with windows XP. though ill tell you in brief what you need to do
1)install latest perl
2)install carbide c++ editor
3)install Qt SDK
4)install s60 or N97 emulators
make sure that except perl all the items which are mentioned above will be in same drive,and also
make sure that folder names which you give while installation should not have spaces at all..
i.e suppose if you are going to place any of the above items in a folder whose name is having spaces it will not work.
if you have any doubts feel free to ask.

Resources