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.
Related
I have installed Qt 6.0.3 and 6.1.0.
And I want to create Qt 6 Quick project.
I start Qt Creator, click "New", "Qt Quick Application - Empty", "Choose...".
Then I type the name of my project and click "Next".
On the "Build System" step I select any build system(qmake, CMake or QBS, it does not affect the next step) and click "Next".
On the next step "Details" there is a drop-down with a list of available Qt versions. But it does not contain Qt 6!
How to create Qt 6 Qt Quick project?
Latest Qt Creator's (4.14.2 at the time of answering) new project assistant does not provide the option to require Qt 6 as a minimal version yet. There is an open bug about the missing feature in Qt Bug Tracker: New project assistant: no minimal Qt version >= 6.0
However, as #JarMan already commented you actually configure your project for specific kit and selecting e.g. Qt 6.0.3 kit means that you configure and build your application against that Qt version.
In fact, minimal Qt version selection in Qt Quick application wizard affects versions of the QML import statements used in generated QML files. E.g. selecting Qt 5.12 as minimal version means that you get import QtQuick 2.12 and import QtQuick.Window 2.12 written to your main.qml. And selecting Qt 5.15 as minimal version means getting import QtQuick 2.15 and import QtQuick.Window 2.15, and so on.
In Qt 6 version numbers may be omitted from imports in QML. If the version is omitted, the latest version will be used.
Most probably it means that when Qt Creator starts supporting Qt 6 as minimal version respective generated import statements will be import QtQuick and import QtQuick.Window.
You can actually edit your generated Qt Quick application so that you manually remove version numbers from import statements if you wish. It will turn your application to minimal Qt6 application because that application cannot be built with Qt5 kits anymore.
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!
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.
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
Getting error
module "QtCommercial.Chart" is not installed
when trying to import
QtCommercial.Chart 1.3
in qml file
Please help
Assuming you have a commercial license, and have downloaded Charts via the Maintenance Tool... Unlike other Qt modules, Charts does not come pre-built. Only the source seems to be provided (as of Qt 5.2.1). See Digia's QtCharts documentation for instructions on how to build from source, and to include it in your project.