Add modules to Qt and qt

Source: Internet
Author: User

Add modules to Qt and qt
Add Qt module QtCanvas3D

Because you need to use Qt Quick3D drawingTherefore, I found some information on the Internet.

Javascript draws 3D ThreeJS libraries and should be used for QML. Continue searching and find that there is a QtCanvas3D module in Qt that can be used for 3D Painting. Follow the official Qt tutorial to import the module.

import QtCanvas3D 1.1

But the problem arises. The QtCreator prompts "QML Module not found". It turns out that this Module is not available on the computer, so install this Module. I found a circle, did not find a better method to install the module, and finally found the source code address of qtcanvas3d on GitHub

It should be okay to compile the file by yourself. Next we will talk about the experiences of installing modules.

1.Download the corresponding version of qtcanvas3d, The Qt version I used is 5.6, download and unzip to get the qtcanvas3d-5.6 folder.

 

For convenience, I put it in the <QT Install Dir>/5.6 directory (which stores the corresponding compiler configurations and library folders ).

2.Open the qtcanvas3d-5.6/src/imports/qtcanvas3d directory and open it directly with QtCreatorQtcanvas3d. proTo get a qtcanvas3d Project

Open the properties of this projectThe Shadow Build in the Build settings is canceled (you can also specify the target location, but the corresponding dll file is not compiled after I specify it)

The new directory qml can be obtained in the <Qt Install Dir>/5.6/qtcanvas3d-5.6/directory, and the folder QtCanvas3D is the compiled library file.

Is the library file compiled by msvc compiler, but copies the entire QtCanvas3D folder to the <Qt Install Dir>/5.6/msvc20xx_64/qml directory, the QtCanvas3D module cannot be found in QtCreator.

3. Refer to official documentsQML Modules, which indicates that to add a plug-in, you also need two files: qmldir and plugins. qmltypes. These two files are available in the source code (the two files in the qtcanvas3d project in the source code are the files we need ),

Copy to the corresponding directory,Reopen QtCreator, Then look at the project and find that the "Module not found" prompt has disappeared. Import module successful!

 

-----------------------------------------------

When I added the qtcanvas3d library, I made a stupid mistake.

I first compiled the library file with MinGW 32, then copied the library file to the <Qt Install Dir>/5.6/mingwxx_xx/qml directory, but set qmldir and plugins. qmltypes copies the corresponding location and prompts me that the module is not found.

Finally, I found that my project is using the msvc compiler, And the search plug-in is found in the corresponding msvc directory. No wonder I have no way to add the plug-in for any modifications. Finally, compile QtCanvas3D with msvc again and put it under the plug-in directory of msvc compiler.

 

You can also customize the plug-in path according to the reply in the forum. You need to add a QML2_IMPORT_PATH variable in the Build Environment and point it to the corresponding directory. I tried this method but it is useless.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.