Qt Data Visualization Getting Started
Installing the Qt Data Visualization Module
Use the Package Manager
in Maintenance Tool
or the Online installer
to install the Qt Data Visualization module. The module can be found under Qt Enterprise Add-Ons
in the package manager.
After installation Qt Data Visualization documentation and examples are available in Qt Creator. Examples can be found on the examples page of Qt Creator by selecting the Qt Data Visualization component from the drop-down menu.
The source code is installed into the QtDataVisualization folder under EnterpriseAddOns.
Building Qt Data Visualization
To build the Qt Data Visualization module from source code yourself, set up a command prompt with an environment for building Qt applications, navigate to the directory containing qtdatavisualization.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 |
OS X | 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/OS X 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 Qt Data Visualization module, give the following commands:
qmake CONFIG+=static make make install
Creating a Simple Application
To create a simple application, start by creating a new Qt Gui Application project in Qt Creator and add this line to the .pro
file of the project:
QT += datavisualization
In the main.cpp
file, include the module headers and declare namespace usage:
#include <QtDataVisualization> using namespace QtDataVisualization;
Then, add the sample code found in one of the following pages, depending on what kind of visualization you are interested in: How to construct a minimal Q3DBars graph, How to construct a minimal Q3DScatter graph, or How to construct a minimal Q3DSurface graph.
To use Qt Data Visualization graphs in widget based applications, you can use the QWidget::createWindowContainer() function to wrap the graph into a widget:
Q3DBars *graph = new Q3DBars(); QWidget *container = QWidget::createWindowContainer(graph);
For further code examples, see one of the Qt Data Visualization examples:
Simple application showing real time audio data. | |
Implementing a custom input handler to support axis dragging. | |
Using Q3DBars in a widget application. | |
Implementing custom input handler in a widget application. | |
Adding custom items to a surface graph. | |
Using Q3DBars with a custom proxy. | |
Using an item model as data source for Q3DBars. | |
Implementing axis dragging in QML | |
Example of a hybrid C++ and QML application demonstrating different axis formatters. | |
Using Bars3D in a QML application. | |
Customizing input in a QML application. | |
Showing graph legend in a QML application. | |
Showing multiple graphs simultaneously in a QML application. | |
Example of a hybrid C++ and QML application. | |
Using Scatter3D in a QML application. | |
Showing spectrogram graph in a QML application. | |
Using Surface3D in a QML application. | |
Using multiple series with Surface3D in a QML application. | |
Using rotated scatter items | |
Using Q3DScatter in a widget application. | |
Using Q3DSurface in a widget application. | |
Using texture with Q3DSurface. | |
Rendering volumetric objects. |
© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.