Qt Canvas 3D Getting Started

Building Qt Canvas 3D

To build the Qt Canvas 3D module from source code, set up a command prompt with an environment for building Qt applications, navigate to the directory containing qtcanvas3d.pro , and configure the project with qmake:

qmake
					

After running qmake, build the project with make:

OS Make command
Linux make
Windows (MinGw) mingw32-make
Windows (MSVC) nmake
OSX make

The above generates the default makefiles for your configuration, which is typically the release build if you are using precompiled binary Qt distribution. To build both debug and release, or one specifically, use one of the following qmake lines instead.

For debug builds:

qmake CONFIG+=debug
make
					

or

qmake CONFIG+=debug_and_release
make debug
					

For release builds:

qmake CONFIG+=release
make
					

or

qmake CONFIG+=debug_and_release
make release
					

For both builds (Windows/Mac only):

qmake CONFIG+="debug_and_release build_all"
make
					

After building, install the module to your Qt directory:

make install
					

If you want to uninstall the module:

make uninstall
					

To build a statically linked version of the QtCanvas3D module, give the following commands:

qmake CONFIG+=static
make
make install
					
					

运行范例

Examples for Qt Canvas 3D are found under the examples/canvas3d subdirectory. To build and run a single example, in this case interaction , navigate to the example directory and enter the following commands:

qmake
make
./interaction
					

注意: On some platforms, such as Windows, the executable can be generated under debug or release folders, depending on your build.

A Basic Example

For a simple Canvas3D example, see the Lit and Textured Cube Example .

For all examples, check out Qt Canvas 3D Examples .

Creating Qt Canvas 3D Project

For convenience, Qt Canvas 3D comes with a Qt Creator wizard template. The template is provided with the source package and can be found under creatortemplates folder. The Qt Canvas 3D wizard creates a project that includes QML and JavaScript files. It also has, by default, code that draws a cube.

In order to use the wizard template it needs to be copied to the correct location. For more details of the correct location, please see Locating Wizards .