Why can't I import Qt3D modules? - qt

I'm going to start a project with Qt Canvas 3D application, but at the moment of importing modules it marks me error because they need those modules that are the following:
import Qt3D 1.0
import Qt3D.Shapes 1.0
Does anyone know how I can attach them? (Download link, download command or some other solution).
Thank you.

Which version of Qt are you using?
Qt 5.4 and newer come with Qt3D 2.0, so it might be that you are following some old tutorial or something, and trying to import Qt3D 1.0 because instead of Qt3D 2.0?
If so, the API has also changed a lot so you would be better off finding an example using Qt3D 2.0 to get you started. Take a look at any examples you have installed that are using Qt3D, and take a lookQt 3D QML Types for an example on importing v 2.0.

Here are some examples for Canvas3D. It's for Qt 5.9, but I think most of them were the same in 5.8. They also come with the Qt creator, just search "canvas 3d" in the welcome screen

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.

Qt6 imports with qtcreator 4.13+

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.

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

Cannot create Qt qml project with Qt commercial charts

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.

OpenGL program does not compile with QT 5.0

I followed this turial to create a very simple openGL program with QT.
I have QT 5.0. I created a new empty QT project, created all files as in the tutorial but the compilation failed. The cause is that certain methods like glShadeModel() are not recognized.
I tried include GL/glu.h (which include glShadeModel for instance) but this time there is a conflict with several openGL types. But according to the tutorial all opengl methods should be included in QtOpenGL. Maybe I have a too much recent version of QT. I'm lost.
Does anyone can help me ?
Qt5 is based on OpenGL ES 2.0, and this is a subset of desktop OpenGL, even some Qt tutorials are not adapted to this change yet. You will have to build Qt 5.0 with normal OpenGL if you wish to compile those tutorials.
i may only give you some points to check.
in .pro
*QT += opengl
*check your GPU for supporting the opengl version you are using, for example my laptop is only compatible with 2.1 opengl.
also please use "Qt" instead "QT", QT stands for quicktime by Apple.

Resources