mirror of https://github.com/qt/qtdatavis3d.git
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: tests/auto/cpptest/q3dscene/tst_scene.cpp tests/auto/qmltest/scene3d/tst_scene.qml Change-Id: I0aef5e7d8fe202e7f4c7565922938d1627ab8124
This commit is contained in:
commit
54910f8cf8
|
|
@ -0,0 +1,5 @@
|
|||
Qt Data Visualization 5.7.1
|
||||
|
||||
Fixed Issues
|
||||
------------
|
||||
- [QTBUG-57075] Make sure that the formatters respect zero and negative values correctly as per the settings
|
||||
|
|
@ -45,6 +45,10 @@
|
|||
concentrate on those and skip explaining the basic Q3DBars functionality - for that see
|
||||
\l{Bars Example}.
|
||||
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Visualizing Audio Levels
|
||||
|
||||
\c AudioLevelsIODevice subclasses QIODevice and is given as input device for QAudioInput
|
||||
class, so it receives microphone data.
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@
|
|||
|
||||
\image bars-example.png
|
||||
|
||||
\section1 Creating the application
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Creating the Application
|
||||
|
||||
First, in main.cpp, we create a QApplication, instantiate Q3DBars and a window container
|
||||
for it:
|
||||
|
|
@ -78,7 +80,7 @@
|
|||
|
||||
\snippet bars/main.cpp 3
|
||||
|
||||
\section1 Setting up the graph
|
||||
\section1 Setting up the Graph
|
||||
|
||||
Let's set up the graph in the constructor of the \c GraphModifier class we instantiated in the
|
||||
application main:
|
||||
|
|
@ -125,7 +127,7 @@
|
|||
|
||||
That concludes setting up the graph.
|
||||
|
||||
\section1 Adding data to the graph
|
||||
\section1 Adding Data to the Graph
|
||||
|
||||
At the end of the constructor there's a call:
|
||||
|
||||
|
|
@ -137,7 +139,7 @@
|
|||
|
||||
Now the series have data to show.
|
||||
|
||||
\section1 Using widgets to control the graph
|
||||
\section1 Using Widgets to Control the Graph
|
||||
|
||||
There isn't much interaction yet, so let's continue by adding some widgets back in the
|
||||
application main. Let's just focus on two as an example:
|
||||
|
|
@ -185,7 +187,7 @@
|
|||
\li Axis label rotation
|
||||
\endlist
|
||||
|
||||
\section1 Selecting a row/column by clicking an axis label
|
||||
\section1 Selecting a Row/column by Clicking an Axis Label
|
||||
|
||||
Selection by axis label is default functionality for bar graphs. As an example, you can select
|
||||
rows by clicking an axis label in the following way:
|
||||
|
|
@ -199,7 +201,7 @@
|
|||
You can use the same method with \c SelectionSlice and \c SelectionItem flags, as long as
|
||||
you have either \c SelectionRow or \c SelectionColumn set as well.
|
||||
|
||||
\section1 Zooming to selection
|
||||
\section1 Zooming to Selection
|
||||
|
||||
As an example of adjusting camera target we have implemented an animation of zooming to
|
||||
selection via a button press. Animation initializations are done in the constructor:
|
||||
|
|
@ -223,6 +225,6 @@
|
|||
|
||||
\snippet bars/graphmodifier.cpp 15
|
||||
|
||||
\section1 Example contents
|
||||
\section1 Example Contents
|
||||
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -42,14 +42,16 @@
|
|||
|
||||
\image custominput-example.png
|
||||
|
||||
\section1 Replacing default input handling
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Replacing Default Input Handling
|
||||
|
||||
The default input handling mechanism is replaced by setting the active input handler of
|
||||
Q3DScatter to \c CustomInputHandler that implements the custom behavior.
|
||||
|
||||
\snippet custominput/scatterdatamodifier.cpp 0
|
||||
|
||||
\section1 Implementing custom selection handling
|
||||
\section1 Implementing Custom Selection Handling
|
||||
|
||||
The on mouseover selection handling is implemented in the \c CustomInputHandler that captures
|
||||
the mouse events. It then stores the last known coordinates to the
|
||||
|
|
@ -63,7 +65,7 @@
|
|||
|
||||
\snippet custominput/scatterdatamodifier.cpp 1
|
||||
|
||||
\section1 Implementing custom zoom handling
|
||||
\section1 Implementing Custom Zoom Handling
|
||||
|
||||
The camera has a zoom factor that represents amount of zoom in percentages. In this example the
|
||||
zoom range is limited between 10% and 500%. This range is then divided to four subranges where
|
||||
|
|
@ -71,7 +73,7 @@
|
|||
|
||||
\snippet custominput/custominputhandler.cpp 1
|
||||
|
||||
\section1 Implementing custom camera handling
|
||||
\section1 Implementing Custom Camera Handling
|
||||
|
||||
The camera is animated to constantly rotate around the graph with two animations. The rotation
|
||||
around the graph is done with a simple QPropertyAnimation that just increments during 20
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@
|
|||
|
||||
\image customitems-example.png
|
||||
|
||||
\section1 Adding custom meshes to the application
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Adding Custom Meshes to the Application
|
||||
|
||||
We'll add the meshes in a resource file:
|
||||
|
||||
|
|
@ -53,7 +55,7 @@
|
|||
</RCC>
|
||||
\endcode
|
||||
|
||||
\section1 Adding custom item to a graph
|
||||
\section1 Adding Custom Item to a Graph
|
||||
|
||||
In this example we do not have specific textures for our meshes, so we'll just create a small
|
||||
QImage and fill it with a single color:
|
||||
|
|
@ -73,7 +75,7 @@
|
|||
|
||||
\snippet customitems/customitemgraph.cpp 3
|
||||
|
||||
\section1 Removing custom item from a graph
|
||||
\section1 Removing Custom Item from a Graph
|
||||
|
||||
We'll just call \c removeCustomItemAt() with the position of the item:
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
The custom proxy we provide here is similar to item model based proxies provided by Qt
|
||||
Data Visualization in that it requires a mapping to interpret the data.
|
||||
|
||||
Let's take a closer look at the custom classes:
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 VariantDataSet
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,9 @@
|
|||
|
||||
\image draggableaxes-example.png
|
||||
|
||||
\section1 Replacing default input handling
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Replacing Default Input Handling
|
||||
|
||||
The default input handling mechanism is replaced by setting the active input handler of
|
||||
Q3DScatter to \c AxesInputHandler that implements the custom behavior:
|
||||
|
|
@ -56,7 +58,7 @@
|
|||
|
||||
\snippet draggableaxes/data.cpp 2
|
||||
|
||||
\section1 Extending mouse event handling
|
||||
\section1 Extending Mouse Event Handling
|
||||
|
||||
First of all, we inherited our input handler from Q3DInputHandler instead of
|
||||
QAbstract3DInputHandler. The reason for doing this is to keep all the functionality of the
|
||||
|
|
@ -83,7 +85,7 @@
|
|||
|
||||
We don't need to change the functionality of mouse wheel, so we will not re-implement that.
|
||||
|
||||
\section1 Implementing axis dragging
|
||||
\section1 Implementing Axis Dragging
|
||||
|
||||
First we need to start listening to the selection signal from the graph. We do that in the
|
||||
constructor, and connect it to \c handleElementSelected method:
|
||||
|
|
@ -129,5 +131,5 @@
|
|||
The modifier could be adjusted automatically based on the axis range and camera zoom level, but
|
||||
we'll leave implementing that as an excercise for the reader.
|
||||
|
||||
\section1 Example contents
|
||||
\section1 Example Contents
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -46,7 +46,9 @@
|
|||
|
||||
\image itemmodel-example-2.png
|
||||
|
||||
\section1 Creating the application
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Creating the Application
|
||||
|
||||
First, in main.cpp, we create a QApplication, instantiate Q3DBars and a window container for it:
|
||||
|
||||
|
|
@ -85,7 +87,7 @@
|
|||
|
||||
\snippet itemmodel/main.cpp 4
|
||||
|
||||
\section1 Setting up the graph
|
||||
\section1 Setting up the Graph
|
||||
|
||||
Let's set up the visual attributes for the graph in the constructor of \c GraphDataGenerator:
|
||||
|
||||
|
|
@ -113,7 +115,7 @@
|
|||
\note You do not need to set any of these in case you're happy with the defaults. You can
|
||||
easily try them by commenting out the contents of the constructor.
|
||||
|
||||
\section1 Adding data to the graph
|
||||
\section1 Adding Data to the Graph
|
||||
|
||||
We created the data generator in the application main and gave it the graph and the table
|
||||
widget as parameters:
|
||||
|
|
@ -163,7 +165,7 @@
|
|||
rows and columns for itself directly, as we set the QItemModelBarDataProxy::useModelCategories
|
||||
property to true, and the graph gets the data to be displayed via the series that owns the proxy.
|
||||
|
||||
\section1 Interacting with the data
|
||||
\section1 Interacting with the Data
|
||||
|
||||
We made a couple of signal connections in the application main earlier:
|
||||
|
||||
|
|
@ -188,5 +190,5 @@
|
|||
|
||||
\image itemmodel-example.png
|
||||
|
||||
\section1 Example contents
|
||||
\section1 Example Contents
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -40,7 +40,9 @@
|
|||
|
||||
\image qmlaxisdrag-example.png
|
||||
|
||||
\section1 Overriding default input handling
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Overriding Default Input Handling
|
||||
|
||||
First we deactivate the default input handling mechanism by setting the active input handler
|
||||
of Scatter3D graph to \c{null}:
|
||||
|
|
@ -71,7 +73,7 @@
|
|||
\dots 0
|
||||
\snippet qmlaxisdrag/qml/qmlaxisdrag/main.qml 4
|
||||
|
||||
\section1 Translating mouse movement to axis range change
|
||||
\section1 Translating Mouse Movement to Axis Range Change
|
||||
|
||||
in \c scatterGraph we will need to listen to \c onSelectedElementChanged signal. The signal
|
||||
is emitted after the selection query has been made in the \c{onPressed} of \c{inputArea}. We
|
||||
|
|
@ -97,7 +99,7 @@
|
|||
For a more sophisticated conversion from mouse movement to axis range update, see
|
||||
\l{Axis Range Dragging With Labels Example}{this example}.
|
||||
|
||||
\section1 Other features
|
||||
\section1 Other Features
|
||||
|
||||
The example also demonstrates how to use orthographic projection and how to update properties
|
||||
of a custom item on the fly.
|
||||
|
|
@ -117,5 +119,5 @@
|
|||
\snippet qmlaxisdrag/qml/qmlaxisdrag/main.qml 10
|
||||
\dots
|
||||
|
||||
\section1 Example contents
|
||||
\section1 Example Contents
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -43,7 +43,9 @@
|
|||
that and skip explaining the basic functionality - for
|
||||
more detailed QML example documentation, see \l{Qt Quick 2 Scatter Example}.
|
||||
|
||||
\section1 Custom axis formatter
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Custom Axis Formatter
|
||||
|
||||
Customizing axis formatters requires subclassing the QValue3DAxisFormatter, which cannot be
|
||||
done in QML code alone. In this example we want an axis that interprets the float values as
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@
|
|||
at once. We'll concentrate on those and skip explaining the basic Bars3D functionality - for
|
||||
more detailed QML example documentation, see \l{Qt Quick 2 Scatter Example}.
|
||||
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Data
|
||||
|
||||
The example data is monthly income and expenses of a fictional company over several years.
|
||||
|
|
@ -91,7 +93,7 @@
|
|||
|
||||
We use the \c visible property of the series to hide the second series for now.
|
||||
|
||||
\section1 Custom axis labels
|
||||
\section1 Custom Axis Labels
|
||||
|
||||
One interesting tidbit about axes is that we redefine the category labels for column axis in
|
||||
\c Axes.qml. This is done because the data contains numbers for months, which we don't want
|
||||
|
|
@ -102,7 +104,7 @@
|
|||
We also set automatic axis label rotation to make axis labels more readable at low camera
|
||||
angles.
|
||||
|
||||
\section1 Switching series
|
||||
\section1 Switching Series
|
||||
|
||||
In the \c main.qml, we set up the graph and various UI elements. There are three interesting
|
||||
code blocks we want to highlight here. The first one shows how to change the
|
||||
|
|
|
|||
|
|
@ -40,7 +40,9 @@
|
|||
|
||||
\image qmlcustominput-example.png
|
||||
|
||||
\section1 Removing default input handling
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Removing Default Input Handling
|
||||
|
||||
The default input handling mechanism is disabled by setting the inputHandler property to null.
|
||||
|
||||
|
|
@ -49,7 +51,7 @@
|
|||
\snippet qmlcustominput/qml/qmlcustominput/main.qml 1
|
||||
\dots 0
|
||||
|
||||
\section1 Implementing custom selection handling
|
||||
\section1 Implementing Custom Selection Handling
|
||||
|
||||
The on mouseover selection handling is implemented using standard MouseArea to capture the mouse events.
|
||||
The mouse area is configured to capture hover events and has two custom properties for \c mouseX and \c mouseY
|
||||
|
|
@ -66,7 +68,7 @@
|
|||
|
||||
\snippet qmlcustominput/qml/qmlcustominput/main.qml 4
|
||||
|
||||
\section1 Implementing custom zoom handling
|
||||
\section1 Implementing Custom Zoom Handling
|
||||
|
||||
The camera has a zoom factor that represents amount of zoom in percentages. In this example the zoom range is limited
|
||||
between 10% and 500%. This range is then divided to four subranges where angleDelta is scaled to different amount of zoom change
|
||||
|
|
@ -76,7 +78,7 @@
|
|||
\snippet qmlcustominput/qml/qmlcustominput/main.qml 5
|
||||
\dots
|
||||
|
||||
\section1 Implementing custom camera handling
|
||||
\section1 Implementing Custom Camera Handling
|
||||
|
||||
The camera is animated to constantly rotate around the graph with two animations. The rotation around the graph is done with
|
||||
a simple NumberAnimation that just increments during 20 seconds from 0 degrees to 360 degrees and sets the \l Q3DCamera::xRotation property.
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@
|
|||
that and skip explaining the basic functionality - for
|
||||
more detailed QML example documentation, see \l{Qt Quick 2 Scatter Example}.
|
||||
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Legend
|
||||
|
||||
The legend is simply a column of custom \c LegendItem items inside a transparent rectangle.
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@
|
|||
simultaneously, so most functionality is not explained in detail.
|
||||
For more detailed QML example documentation, see \l{Qt Quick 2 Scatter Example}.
|
||||
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Multiple Graphs
|
||||
|
||||
Using multiple graphs in a single application doesn't require anything special, simply define
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@
|
|||
that and skip explaining the basic functionality - for
|
||||
more detailed QML example documentation, see \l{Qt Quick 2 Scatter Example}.
|
||||
|
||||
\section1 Data source in C++
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Data Source in C++
|
||||
|
||||
The item model based proxies are good for simple and/or static graphs, but to achieve
|
||||
best performance when displaying data changing in realtime, the basic proxies should be used.
|
||||
|
|
@ -110,7 +112,7 @@
|
|||
|
||||
\snippet qmloscilloscope/qml/qmloscilloscope/main.qml 3
|
||||
|
||||
\section1 Enabling direct rendering
|
||||
\section1 Enabling Direct Rendering
|
||||
|
||||
Since this application potentially deals with a lot of rapidly changing data, we use direct
|
||||
rendering mode for performance. To enable antialiasing in this mode the surface format of the application
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@
|
|||
|
||||
\image qmlscatter-example.png
|
||||
|
||||
\section1 Application basics
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Application Basics
|
||||
|
||||
Before diving into the QML code, let's take a look at the application \c main.cpp.
|
||||
|
||||
|
|
@ -72,7 +74,7 @@
|
|||
|
||||
\snippet qmlscatter/main.cpp 2
|
||||
|
||||
\section1 Setting up the graph
|
||||
\section1 Setting up the Graph
|
||||
|
||||
First we'll import all the QML modules we need:
|
||||
|
||||
|
|
@ -111,7 +113,7 @@
|
|||
|
||||
Then it's time to start feeding the graph some data.
|
||||
|
||||
\section1 Adding data to the graph
|
||||
\section1 Adding Data to the Graph
|
||||
|
||||
Let's create a \c Data item inside the \c mainView and name it \c seriesData:
|
||||
|
||||
|
|
@ -171,5 +173,5 @@
|
|||
|
||||
And we're done!
|
||||
|
||||
\section1 Example contents
|
||||
\section1 Example Contents
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@
|
|||
functionality is not explained. For more detailed QML example documentation,
|
||||
see \l{Qt Quick 2 Scatter Example}.
|
||||
|
||||
\section1 Creating a spectrogram
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Creating a Spectrogram
|
||||
|
||||
To create a 2D spectrogram, we define a Surface3D item:
|
||||
|
||||
|
|
@ -66,7 +68,7 @@
|
|||
|
||||
\snippet qmlspectrogram/qml/qmlspectrogram/main.qml 2
|
||||
|
||||
\section1 Polar spectrogram
|
||||
\section1 Polar Spectrogram
|
||||
|
||||
Depending on the data, it is sometimes more natural to use a polar graph instead of a cartesian
|
||||
one. Qt Data Visualization supports this via \l{AbstractGraph3D::polar}{polar} property.
|
||||
|
|
@ -96,5 +98,5 @@
|
|||
\l{InputHandler3D::rotationEnabled}{rotationEnabled} property of the \c{customInputHandler}
|
||||
to control the rotation.
|
||||
|
||||
\section1 Example contents
|
||||
\section1 Example Contents
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@
|
|||
we skip explaining the application creation. For more detailed QML example documentation,
|
||||
see \l{Qt Quick 2 Scatter Example}.
|
||||
|
||||
\section1 Adding data to the graph
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Adding Data to the Graph
|
||||
|
||||
This example shows two methods to set data to surface graph, using the HeightMapSurfaceDataProxy
|
||||
and ItemModelSurfaceDataProxy. First we go through setting the data using the height map specific
|
||||
|
|
@ -73,7 +75,7 @@
|
|||
\dots 0
|
||||
\snippet qmlsurface/qml/qmlsurface/main.qml 6
|
||||
|
||||
\section1 Showing data
|
||||
\section1 Showing Data
|
||||
|
||||
In the \c main.qml, we set up the Surface3D element to show the data and various UI elements
|
||||
to illustrate few interesting features.
|
||||
|
|
@ -115,5 +117,5 @@
|
|||
250 on height map proxy to show exaggerated height. At the same time the middle color position
|
||||
on the gradient is modified to match the value range change.
|
||||
|
||||
\section1 Example contents
|
||||
\section1 Example Contents
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@
|
|||
map images, so in this section we skip explaining the application creation. For a more detailed
|
||||
QML example documentation, see \l{Qt Quick 2 Scatter Example}.
|
||||
|
||||
\section1 Adding data to the graph
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Adding Data to the Graph
|
||||
|
||||
This example shows how to add several surface series to one graph using using
|
||||
HeightMapSurfaceDataProxies and how to control their visibilities individually.
|
||||
|
|
@ -65,7 +67,7 @@
|
|||
\snippet qmlsurfacelayers/qml/qmlsurfacelayers/main.qml 2
|
||||
\dots
|
||||
|
||||
\section1 Controlling the graph
|
||||
\section1 Controlling the Graph
|
||||
|
||||
Let's add some checkboxes to control the visibility of layers:
|
||||
|
||||
|
|
@ -87,5 +89,5 @@
|
|||
|
||||
\snippet qmlsurfacelayers/qml/qmlsurfacelayers/main.qml 6
|
||||
|
||||
\section1 Example contents
|
||||
\section1 Example Contents
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -45,7 +45,9 @@
|
|||
|
||||
\image rotations-example.png
|
||||
|
||||
\section1 Using rotations
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Using Rotations
|
||||
|
||||
In this example we want to orient the arrow items tangentially to the origin. This requires
|
||||
rotating them, which can be achieved by specifying rotation quaternion to each item:
|
||||
|
|
@ -58,7 +60,7 @@
|
|||
for Y-axis and one for Z-axis, and then multiply these together to get the total rotation,
|
||||
which we set to the data item.
|
||||
|
||||
\section1 Using custom item meshes
|
||||
\section1 Using Custom Item Meshes
|
||||
|
||||
The narrow arrow mesh we use for magnetic field arrow items is not a standard mesh. Instead
|
||||
we supply our own \c{narrowarrow.obj} file which contains the object definition for the mesh
|
||||
|
|
@ -66,7 +68,7 @@
|
|||
|
||||
\snippet rotations/scatterdatamodifier.cpp 3
|
||||
|
||||
\section1 Using range gradient
|
||||
\section1 Using Range Gradient
|
||||
|
||||
Setting the color style to range gradient in a series means that the item is colored according
|
||||
to its relative Y-value on the visible Y-coordinate range. We want the arrows on the bottom
|
||||
|
|
@ -75,5 +77,5 @@
|
|||
|
||||
\snippet rotations/scatterdatamodifier.cpp 4
|
||||
|
||||
\section1 Example contents
|
||||
\section1 Example Contents
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@
|
|||
|
||||
\image scatter-example.png
|
||||
|
||||
\section1 Creating the application
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Creating the Application
|
||||
|
||||
First, in main.cpp, we create a QApplication, instantiate Q3DScatter, and a window container
|
||||
for it:
|
||||
|
|
@ -76,7 +78,7 @@
|
|||
|
||||
\snippet scatter/main.cpp 3
|
||||
|
||||
\section1 Setting up the graph
|
||||
\section1 Setting up the Graph
|
||||
|
||||
Let's set up some visual qualities for the graph in the constructor of the \c ScatterDataModifier
|
||||
class we instantiated in the application main:
|
||||
|
|
@ -93,7 +95,7 @@
|
|||
|
||||
That concludes setting up the graph.
|
||||
|
||||
\section1 Adding data to the graph
|
||||
\section1 Adding Data to the Graph
|
||||
|
||||
The last thing we do in the \c ScatterDataModifier constructor is to add data to the graph:
|
||||
|
||||
|
|
@ -121,7 +123,7 @@
|
|||
Now our graph has the data and is ready to be used. There isn't much interaction yet, though,
|
||||
so let's continue by adding some widgets to play with.
|
||||
|
||||
\section1 Using widgets to control the graph
|
||||
\section1 Using Widgets to Control the Graph
|
||||
|
||||
First, back in the application main, we'll create some widgets:
|
||||
|
||||
|
|
@ -153,5 +155,5 @@
|
|||
\li Label font
|
||||
\endlist
|
||||
|
||||
\section1 Example contents
|
||||
\section1 Example Contents
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@
|
|||
|
||||
\image surface-example.png
|
||||
|
||||
\section1 Creating the application
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Creating the Application
|
||||
|
||||
First, in \c main.cpp, we create a QApplication, instantiate Q3DSurface, and a window container
|
||||
for it:
|
||||
|
|
@ -71,7 +73,7 @@
|
|||
signals from widgets into methods in \c surfacegraph.cpp. Next chapter explains more
|
||||
about using Q3DSurface.
|
||||
|
||||
\section1 Setting up proxies and data
|
||||
\section1 Setting up Proxies and Data
|
||||
|
||||
First we instantiate a new QSurfaceDataProxy and attach it to a new QSurface3DSeries:
|
||||
|
||||
|
|
@ -107,7 +109,7 @@
|
|||
|
||||
\snippet surface/surfacegraph.cpp 4
|
||||
|
||||
\section1 Selection modes
|
||||
\section1 Selection Modes
|
||||
|
||||
Q3Dsurface supports three different selection modes. These are demonstrated in the
|
||||
example with radio buttons, which the user can use to activate a suitable selection mode.
|
||||
|
|
@ -115,7 +117,7 @@
|
|||
|
||||
\snippet surface/surfacegraph.h 0
|
||||
|
||||
\section1 Axis ranges for studying the graph
|
||||
\section1 Axis Ranges for Studying the Graph
|
||||
|
||||
The example has four slider controls for adjusting the min and max values for X and Z
|
||||
axis. When selecting the proxy these sliders are adjusted so that one step on the slider
|
||||
|
|
@ -136,7 +138,7 @@
|
|||
|
||||
\snippet surface/surfacegraph.cpp 6
|
||||
|
||||
\section1 Custom surface gradients
|
||||
\section1 Custom Surface Gradients
|
||||
|
||||
The example demonstrates the custom surface gradients with two push buttons. The gradient
|
||||
can be defined with QLinearGradient where the desired colors are set to positions. The following
|
||||
|
|
|
|||
|
|
@ -45,7 +45,9 @@
|
|||
|
||||
\image texturesurface-example.png
|
||||
|
||||
\section1 Texture to a surface series
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Texture to a Surface Series
|
||||
|
||||
The image to be set as a texture to a surface can be set using QSurface3DSeries::setTextureFile().
|
||||
In this example we have added a check box to control if the texture is set or not. The
|
||||
|
|
@ -55,7 +57,7 @@
|
|||
|
||||
\snippet texturesurface/surfacegraph.cpp 0
|
||||
|
||||
\section1 Topographic surface series
|
||||
\section1 Topographic Surface Series
|
||||
|
||||
The topographic data for this example is obtained from National Land Survey of Finland. It
|
||||
provides a product called \c{Elevation Model 2 m}, which was suitable for our needs. We selected
|
||||
|
|
@ -76,7 +78,7 @@
|
|||
And then the actual decoding.
|
||||
\snippet texturesurface/topographicseries.cpp 1
|
||||
|
||||
\section1 Use custom input handler to enable zooming and panning
|
||||
\section1 Use Custom Input Handler to Enable Zooming and Panning
|
||||
|
||||
For the panning the implementation is similar to the \l{Axis Range Dragging With Labels Example}.
|
||||
The difference is that in this example we follow only dragging of X and Z axis and we don't
|
||||
|
|
@ -98,7 +100,7 @@
|
|||
|
||||
\snippet texturesurface/custominputhandler.cpp 2
|
||||
|
||||
\section1 Highlight an area of the surface
|
||||
\section1 Highlight an Area of the Surface
|
||||
|
||||
The main idea on creating a highlight on the surface is to create a copy of the series and add
|
||||
a bit of offset to the y value. On this example the class \c HighlightSeries implements the
|
||||
|
|
@ -115,7 +117,7 @@
|
|||
|
||||
\snippet texturesurface/highlightseries.cpp 1
|
||||
|
||||
\section1 A gradient to the highlight series
|
||||
\section1 A Gradient to the Highlight Series
|
||||
|
||||
Since the \c HighlightSeries is QSurface3DSeries, we can use all the decoration methods series can
|
||||
have. In this example we added a gradient to emphasize the elevation. Because the suitable gradient
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@
|
|||
|
||||
\image volumetric-example.png
|
||||
|
||||
\section1 Initializing volume item
|
||||
\include examples-run.qdocinc
|
||||
|
||||
\section1 Initializing Volume Item
|
||||
|
||||
The QCustom3DVolume items are special custom items (see QCustom3DItem), which can be used
|
||||
to display volumetric data. The volume items are only supported with orthographic projection,
|
||||
|
|
@ -78,7 +80,7 @@
|
|||
|
||||
\snippet volumetric/volumetric.cpp 3
|
||||
|
||||
\section1 Slicing into the volume
|
||||
\section1 Slicing into the Volume
|
||||
|
||||
Unless the volume is largely transparent, you can only see the surface of it, which is often
|
||||
not very helpful. One way to inspect the internal structure of the volume is to view the slices
|
||||
|
|
@ -99,7 +101,7 @@
|
|||
|
||||
\snippet volumetric/volumetric.cpp 9
|
||||
|
||||
\section1 Adjusting volume transparency
|
||||
\section1 Adjusting Volume Transparency
|
||||
|
||||
Sometimes viewing just the slices doesn't give you a good understanding of the volume's internal
|
||||
structure. QCustom3DVolume provides two properties that can be used to adjust the volume
|
||||
|
|
@ -121,7 +123,7 @@
|
|||
|
||||
\snippet volumetric/volumetric.cpp 12
|
||||
|
||||
\section1 High definition vs. low definition shader
|
||||
\section1 High Definition vs. Low Definition Shader
|
||||
|
||||
By default the volume rendering uses the high definition shader. It accounts for each
|
||||
voxel of the volume with correct weight when ray-tracing the volume contents,
|
||||
|
|
@ -136,5 +138,5 @@
|
|||
|
||||
\snippet volumetric/volumetric.cpp 13
|
||||
|
||||
\section1 Example contents
|
||||
\section1 Example Contents
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -124,6 +124,8 @@ private:
|
|||
|
||||
friend class Abstract3DController;
|
||||
friend class Bars3DController;
|
||||
friend class QScatterDataProxyPrivate;
|
||||
friend class QSurfaceDataProxyPrivate;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE_DATAVISUALIZATION
|
||||
|
|
|
|||
|
|
@ -84,6 +84,8 @@ protected:
|
|||
friend class QAbstract3DAxis;
|
||||
friend class QValue3DAxis;
|
||||
friend class QCategory3DAxis;
|
||||
friend class QScatterDataProxyPrivate;
|
||||
friend class QSurfaceDataProxyPrivate;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE_DATAVISUALIZATION
|
||||
|
|
|
|||
|
|
@ -326,6 +326,8 @@ void QBar3DSeriesPrivate::connectControllerAndProxy(Abstract3DController *newCon
|
|||
&Bars3DController::handleDataRowLabelsChanged);
|
||||
QObject::connect(barDataProxy, &QBarDataProxy::columnLabelsChanged, controller,
|
||||
&Bars3DController::handleDataColumnLabelsChanged);
|
||||
QObject::connect(qptr(), &QBar3DSeries::dataProxyChanged, controller,
|
||||
&Bars3DController::handleArrayReset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -306,6 +306,8 @@ void QScatter3DSeriesPrivate::connectControllerAndProxy(Abstract3DController *ne
|
|||
controller, &Scatter3DController::handleItemsRemoved);
|
||||
QObject::connect(scatterDataProxy, &QScatterDataProxy::itemsInserted,
|
||||
controller, &Scatter3DController::handleItemsInserted);
|
||||
QObject::connect(qptr(), &QScatter3DSeries::dataProxyChanged,
|
||||
controller, &Scatter3DController::handleArrayReset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "qscatterdataproxy_p.h"
|
||||
#include "qscatter3dseries_p.h"
|
||||
#include "qabstract3daxis_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
|
||||
|
||||
|
|
@ -366,7 +367,9 @@ void QScatterDataProxyPrivate::removeItems(int index, int removeCount)
|
|||
m_dataArray->remove(index, removeCount);
|
||||
}
|
||||
|
||||
void QScatterDataProxyPrivate::limitValues(QVector3D &minValues, QVector3D &maxValues) const
|
||||
void QScatterDataProxyPrivate::limitValues(QVector3D &minValues, QVector3D &maxValues,
|
||||
QAbstract3DAxis *axisX, QAbstract3DAxis *axisY,
|
||||
QAbstract3DAxis *axisZ) const
|
||||
{
|
||||
if (m_dataArray->isEmpty())
|
||||
return;
|
||||
|
|
@ -385,19 +388,25 @@ void QScatterDataProxyPrivate::limitValues(QVector3D &minValues, QVector3D &maxV
|
|||
const QVector3D &pos = m_dataArray->at(i).position();
|
||||
|
||||
float value = pos.x();
|
||||
if (minX > value)
|
||||
if (qIsNaN(value) || qIsInf(value))
|
||||
continue;
|
||||
if (isValidValue(minX, value, axisX))
|
||||
minX = value;
|
||||
if (maxX < value)
|
||||
maxX = value;
|
||||
|
||||
value = pos.y();
|
||||
if (minY > value)
|
||||
if (qIsNaN(value) || qIsInf(value))
|
||||
continue;
|
||||
if (isValidValue(minY, value, axisY))
|
||||
minY = value;
|
||||
if (maxY < value)
|
||||
maxY = value;
|
||||
|
||||
value = pos.z();
|
||||
if (minZ > value)
|
||||
if (qIsNaN(value) || qIsInf(value))
|
||||
continue;
|
||||
if (isValidValue(minZ, value, axisZ))
|
||||
minZ = value;
|
||||
if (maxZ < value)
|
||||
maxZ = value;
|
||||
|
|
@ -413,6 +422,14 @@ void QScatterDataProxyPrivate::limitValues(QVector3D &minValues, QVector3D &maxV
|
|||
maxValues.setZ(maxZ);
|
||||
}
|
||||
|
||||
bool QScatterDataProxyPrivate::isValidValue(float axisValue, float value,
|
||||
QAbstract3DAxis *axis) const
|
||||
{
|
||||
return (axisValue > value && (value > 0.0f
|
||||
|| (value == 0.0f && axis->d_ptr->allowZero())
|
||||
|| (value < 0.0f && axis->d_ptr->allowNegatives())));
|
||||
}
|
||||
|
||||
void QScatterDataProxyPrivate::setSeries(QAbstract3DSeries *series)
|
||||
{
|
||||
QAbstractDataProxyPrivate::setSeries(series);
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
|
||||
|
||||
class QAbstract3DAxis;
|
||||
|
||||
class QScatterDataProxyPrivate : public QAbstractDataProxyPrivate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -61,8 +63,9 @@ public:
|
|||
void insertItem(int index, const QScatterDataItem &item);
|
||||
void insertItems(int index, const QScatterDataArray &items);
|
||||
void removeItems(int index, int removeCount);
|
||||
|
||||
void limitValues(QVector3D &minValues, QVector3D &maxValues) const;
|
||||
void limitValues(QVector3D &minValues, QVector3D &maxValues, QAbstract3DAxis *axisX,
|
||||
QAbstract3DAxis *axisY, QAbstract3DAxis *axisZ) const;
|
||||
bool isValidValue(float axisValue, float value, QAbstract3DAxis *axis) const;
|
||||
|
||||
virtual void setSeries(QAbstract3DSeries *series);
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -440,6 +440,8 @@ void QSurface3DSeriesPrivate::connectControllerAndProxy(Abstract3DController *ne
|
|||
&Surface3DController::handleRowsInserted);
|
||||
QObject::connect(surfaceDataProxy, &QSurfaceDataProxy::itemChanged, controller,
|
||||
&Surface3DController::handleItemChanged);
|
||||
QObject::connect(qptr(), &QSurface3DSeries::dataProxyChanged, controller,
|
||||
&Surface3DController::handleArrayReset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "qsurfacedataproxy_p.h"
|
||||
#include "qsurface3dseries_p.h"
|
||||
#include "qabstract3daxis_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
|
||||
|
||||
|
|
@ -504,7 +505,9 @@ QSurfaceDataProxy *QSurfaceDataProxyPrivate::qptr()
|
|||
return static_cast<QSurfaceDataProxy *>(q_ptr);
|
||||
}
|
||||
|
||||
void QSurfaceDataProxyPrivate::limitValues(QVector3D &minValues, QVector3D &maxValues) const
|
||||
void QSurfaceDataProxyPrivate::limitValues(QVector3D &minValues, QVector3D &maxValues,
|
||||
QAbstract3DAxis *axisX, QAbstract3DAxis *axisY,
|
||||
QAbstract3DAxis *axisZ) const
|
||||
{
|
||||
float min = 0.0f;
|
||||
float max = 0.0f;
|
||||
|
|
@ -524,7 +527,9 @@ void QSurfaceDataProxyPrivate::limitValues(QVector3D &minValues, QVector3D &maxV
|
|||
if (row) {
|
||||
for (int j = 0; j < columns; j++) {
|
||||
float itemValue = m_dataArray->at(i)->at(j).y();
|
||||
if (min > itemValue)
|
||||
if (qIsNaN(itemValue) || qIsInf(itemValue))
|
||||
continue;
|
||||
if (min > itemValue && isValidValue(itemValue, axisY))
|
||||
min = itemValue;
|
||||
if (max < itemValue)
|
||||
max = itemValue;
|
||||
|
|
@ -534,23 +539,59 @@ void QSurfaceDataProxyPrivate::limitValues(QVector3D &minValues, QVector3D &maxV
|
|||
|
||||
minValues.setY(min);
|
||||
maxValues.setY(max);
|
||||
|
||||
if (columns) {
|
||||
// Have some defaults
|
||||
float xLow = m_dataArray->at(0)->at(0).x();
|
||||
float xHigh = m_dataArray->at(0)->last().x();
|
||||
float zLow = m_dataArray->at(0)->at(0).z();
|
||||
float zHigh = m_dataArray->last()->at(0).z();
|
||||
minValues.setX(qMin(xLow, xHigh));
|
||||
minValues.setZ(qMin(zLow, zHigh));
|
||||
maxValues.setX(qMax(xLow, xHigh));
|
||||
maxValues.setZ(qMax(zLow, zHigh));
|
||||
for (int i = 0; i < columns; i++) {
|
||||
float zItemValue = m_dataArray->at(0)->at(i).z();
|
||||
if (qIsNaN(zItemValue) || qIsInf(zItemValue))
|
||||
continue;
|
||||
else if (isValidValue(zItemValue, axisZ))
|
||||
zLow = qMin(zLow,zItemValue);
|
||||
}
|
||||
for (int i = 0; i < columns; i++) {
|
||||
float zItemValue = m_dataArray->last()->at(i).z();
|
||||
if (qIsNaN(zItemValue) || qIsInf(zItemValue))
|
||||
continue;
|
||||
else if (isValidValue(zItemValue, axisZ))
|
||||
zHigh = qMax(zHigh, zItemValue);
|
||||
}
|
||||
for (int i = 0; i < rows; i++) {
|
||||
float xItemValue = m_dataArray->at(i)->at(0).x();
|
||||
if (qIsNaN(xItemValue) || qIsInf(xItemValue))
|
||||
continue;
|
||||
else if (isValidValue(xItemValue, axisX))
|
||||
xLow = qMin(xLow, xItemValue);
|
||||
}
|
||||
for (int i = 0; i < rows; i++) {
|
||||
float xItemValue = m_dataArray->at(i)->last().x();
|
||||
if (qIsNaN(xItemValue) || qIsInf(xItemValue))
|
||||
continue;
|
||||
else if (isValidValue(xItemValue, axisX))
|
||||
xHigh = qMax(xHigh, xItemValue);
|
||||
}
|
||||
minValues.setX(xLow);
|
||||
minValues.setZ(zLow);
|
||||
maxValues.setX(xHigh);
|
||||
maxValues.setZ(zHigh);
|
||||
} else {
|
||||
minValues.setX(0.0f);
|
||||
minValues.setZ(0.0f);
|
||||
maxValues.setX(0.0f);
|
||||
maxValues.setZ(0.0f);
|
||||
minValues.setX(axisX->d_ptr->allowZero() ? 0.0f : 1.0f);
|
||||
minValues.setZ(axisZ->d_ptr->allowZero() ? 0.0f : 1.0f);
|
||||
maxValues.setX(axisX->d_ptr->allowZero() ? 0.0f : 1.0f);
|
||||
maxValues.setZ(axisZ->d_ptr->allowZero() ? 0.0f : 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
bool QSurfaceDataProxyPrivate::isValidValue(float value, QAbstract3DAxis *axis) const
|
||||
{
|
||||
return (value > 0.0f || (value == 0.0f && axis->d_ptr->allowZero())
|
||||
|| (value < 0.0f && axis->d_ptr->allowNegatives()));
|
||||
}
|
||||
|
||||
void QSurfaceDataProxyPrivate::clearRow(int rowIndex)
|
||||
{
|
||||
if (m_dataArray->at(rowIndex)) {
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
|
||||
|
||||
class QAbstract3DAxis;
|
||||
|
||||
class QSurfaceDataProxyPrivate : public QAbstractDataProxyPrivate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -61,7 +63,9 @@ public:
|
|||
void insertRow(int rowIndex, QSurfaceDataRow *row);
|
||||
void insertRows(int rowIndex, const QSurfaceDataArray &rows);
|
||||
void removeRows(int rowIndex, int removeCount);
|
||||
void limitValues(QVector3D &minValues, QVector3D &maxValues) const;
|
||||
void limitValues(QVector3D &minValues, QVector3D &maxValues, QAbstract3DAxis *axisX,
|
||||
QAbstract3DAxis *axisY, QAbstract3DAxis *axisZ) const;
|
||||
bool isValidValue(float value, QAbstract3DAxis *axis) const;
|
||||
|
||||
virtual void setSeries(QAbstract3DSeries *series);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ sourcedirs += ..
|
|||
|
||||
examplesinstallpath = datavisualization
|
||||
|
||||
depends = qtcore qtgui qtqml qtquick qtmultimedia qtdoc
|
||||
depends = qtcore qtgui qtqml qtquick qtmultimedia qtdoc qtwidgets
|
||||
|
||||
qhp.projects = QtDataVisualization
|
||||
|
||||
|
|
|
|||
|
|
@ -80,18 +80,20 @@
|
|||
|
||||
\section1 Articles
|
||||
\list
|
||||
\li \l{Qt Data Visualization Getting Started}{Getting Started}
|
||||
\li \l{Qt Data Visualization Data Handling}{Data Handling}
|
||||
\li \l{Qt Data Visualization Interacting with Data}{Interacting with Data}
|
||||
\li \l{Qt Data Visualization Known Issues}{Known Issues}
|
||||
\endlist
|
||||
|
||||
\section1 References
|
||||
\section1 Examples
|
||||
\list
|
||||
\li \l{Qt Data Visualization Examples}
|
||||
\endlist
|
||||
|
||||
\section1 API Reference
|
||||
\list
|
||||
\li \l{Qt Data Visualization C++ Classes}
|
||||
\li \l{Qt Data Visualization QML Types}
|
||||
\endlist
|
||||
|
||||
Qt Data Visualization comes with the following examples:
|
||||
|
||||
\annotatedlist qtdatavisualization_examples
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@
|
|||
/*!
|
||||
\namespace QtDataVisualization
|
||||
\inmodule QtDataVisualization
|
||||
|
||||
QtDataVisualization namespace holds all the classes and enumerations in the QtDataVisualization
|
||||
\brief Contains the classes and enumerations in the Qt Data Visualization
|
||||
module.
|
||||
|
||||
\generatelist{classesbymodule QtDataVisualization}
|
||||
|
|
@ -77,7 +76,7 @@
|
|||
\group qtdatavisualization_getting_started
|
||||
\title Qt Data Visualization Getting Started
|
||||
|
||||
\section1 Installing the Qt Data Visualization module
|
||||
\section1 Installing the Qt Data Visualization Module
|
||||
|
||||
Use the \c {Package Manager} in \c {Maintenance Tool} or the \c {Online installer} to install
|
||||
the Qt Data Visualization module. The module can be found under \c {Qt Enterprise Add-Ons}
|
||||
|
|
@ -159,18 +158,7 @@
|
|||
|
||||
\snippet doc_src_qtdatavisualization.cpp 7
|
||||
|
||||
\section1 Running examples
|
||||
|
||||
Qt Data Visualization examples are found under the \c examples subdirectory. To build and run a
|
||||
single example, in this case qmlsurface, navigate to the example directory and enter the
|
||||
following commands:
|
||||
|
||||
\snippet doc_src_qtdatavisualization.cpp 8
|
||||
|
||||
\note On some platforms, such as Windows, the executable can be generated under debug or
|
||||
release folders, depending on your build.
|
||||
|
||||
\section1 Creating a simple application
|
||||
\section1 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 \c .pro file of the project:
|
||||
|
|
@ -213,7 +201,7 @@
|
|||
|
||||
\snippet doc_src_qtdatavisualization.cpp 11
|
||||
|
||||
\section1 Data proxies
|
||||
\section1 Data Proxies
|
||||
|
||||
The data that users wish to visualize comes in many formats, all of which cannot obviously be
|
||||
directly supported. Therefore, Qt Data Visualization implements data proxies into which
|
||||
|
|
@ -234,7 +222,7 @@
|
|||
it is usually more efficient to store each set in a different series and just change the series,
|
||||
rather than reset the data in one proxy every time you need to switch.
|
||||
|
||||
\section1 Item models and data mapping
|
||||
\section1 Item Models and Data Mapping
|
||||
|
||||
For common use cases, Qt Data Visualization offers specialized proxies. One such case is having
|
||||
data in an item model (QAbstractItemModel subclass), which is a common way to store data in
|
||||
|
|
@ -264,7 +252,7 @@
|
|||
about how to use them: QItemModelBarDataProxy, QItemModelScatterDataProxy, and
|
||||
QItemModelSurfaceDataProxy.
|
||||
|
||||
\section1 Other custom proxies
|
||||
\section1 Other Custom Proxies
|
||||
|
||||
QHeightMapSurfaceDataProxy is a specialized proxy for generating a surface graph from a
|
||||
heightmap image. See the QHeightMapSurfaceDataProxy documentation for more information.
|
||||
|
|
@ -273,7 +261,7 @@
|
|||
defines a custom data set based on variant lists and an extension of the basic proxy to resolve
|
||||
that data with an associated mapper.
|
||||
|
||||
\section1 Dealing with real-time data
|
||||
\section1 Dealing with Real-time Data
|
||||
|
||||
When you have a data set that updates rapidly, it is important to handle data properly to
|
||||
ensure good performance. Since memory allocation is a costly operation, always use
|
||||
|
|
@ -304,13 +292,13 @@
|
|||
\page qtdatavisualization_interacting_with_data.html
|
||||
\title Qt Data Visualization Interacting with Data
|
||||
|
||||
\section1 Interacting with data
|
||||
\section1 Interacting with Data
|
||||
|
||||
You can interact with the rendered graph with either mouse or touch to rotate, zoom, or select
|
||||
data. For the default mouse controls, see Q3DInputHandler documentation, and for the default
|
||||
touch controls, see QTouch3DInputHandler documentation.
|
||||
|
||||
\section1 Data selection modes
|
||||
\section1 Data Selection Modes
|
||||
|
||||
All visualization types support selecting a single data item - a bar, a scatter item, or a surface
|
||||
vertex - using mouse, touch, and programmatically via the series APIs. The selected item is highlighted
|
||||
|
|
|
|||
|
|
@ -147,7 +147,12 @@ void Bars3DController::synchDataToRenderer()
|
|||
|
||||
void Bars3DController::handleArrayReset()
|
||||
{
|
||||
QBar3DSeries *series = static_cast<QBarDataProxy *>(sender())->series();
|
||||
QBar3DSeries *series;
|
||||
if (qobject_cast<QBarDataProxy *>(sender()))
|
||||
series = static_cast<QBarDataProxy *>(sender())->series();
|
||||
else
|
||||
series = static_cast<QBar3DSeries *>(sender());
|
||||
|
||||
if (series->isVisible()) {
|
||||
adjustAxisRanges();
|
||||
m_isDataDirty = true;
|
||||
|
|
|
|||
|
|
@ -135,7 +135,12 @@ QList<QScatter3DSeries *> Scatter3DController::scatterSeriesList()
|
|||
|
||||
void Scatter3DController::handleArrayReset()
|
||||
{
|
||||
QScatter3DSeries *series = static_cast<QScatterDataProxy *>(sender())->series();
|
||||
QScatter3DSeries *series;
|
||||
if (qobject_cast<QScatterDataProxy *>(sender()))
|
||||
series = static_cast<QScatterDataProxy *>(sender())->series();
|
||||
else
|
||||
series = static_cast<QScatter3DSeries *>(sender());
|
||||
|
||||
if (series->isVisible()) {
|
||||
adjustAxisRanges();
|
||||
m_isDataDirty = true;
|
||||
|
|
@ -394,7 +399,7 @@ void Scatter3DController::adjustAxisRanges()
|
|||
if (scatterSeries->isVisible() && proxy) {
|
||||
QVector3D minLimits;
|
||||
QVector3D maxLimits;
|
||||
proxy->dptrc()->limitValues(minLimits, maxLimits);
|
||||
proxy->dptrc()->limitValues(minLimits, maxLimits, valueAxisX, valueAxisY, valueAxisZ);
|
||||
if (adjustX) {
|
||||
if (!series) {
|
||||
// First series initializes the values
|
||||
|
|
|
|||
|
|
@ -321,7 +321,12 @@ void Surface3DController::clearSelection()
|
|||
|
||||
void Surface3DController::handleArrayReset()
|
||||
{
|
||||
QSurface3DSeries *series = static_cast<QSurfaceDataProxy *>(sender())->series();
|
||||
QSurface3DSeries *series;
|
||||
if (qobject_cast<QSurfaceDataProxy *>(sender()))
|
||||
series = static_cast<QSurfaceDataProxy *>(sender())->series();
|
||||
else
|
||||
series = static_cast<QSurface3DSeries *>(sender());
|
||||
|
||||
if (series->isVisible()) {
|
||||
adjustAxisRanges();
|
||||
m_isDataDirty = true;
|
||||
|
|
@ -510,7 +515,7 @@ void Surface3DController::adjustAxisRanges()
|
|||
if (surfaceSeries->isVisible() && proxy) {
|
||||
QVector3D minLimits;
|
||||
QVector3D maxLimits;
|
||||
proxy->dptrc()->limitValues(minLimits, maxLimits);
|
||||
proxy->dptrc()->limitValues(minLimits, maxLimits, valueAxisX, valueAxisY, valueAxisZ);
|
||||
if (adjustX) {
|
||||
if (first) {
|
||||
// First series initializes the values
|
||||
|
|
|
|||
|
|
@ -30,6 +30,16 @@
|
|||
#ifndef QTOUCH3DINPUTHANDLER_P_H
|
||||
#define QTOUCH3DINPUTHANDLER_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the QtDataVisualization API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
|
||||
#include "q3dinputhandler_p.h"
|
||||
#include "qtouch3dinputhandler.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
import QtQuick 2.0
|
||||
import QtDataVisualization 1.2
|
||||
import QtTest 1.0
|
||||
import QtTest 1.1
|
||||
|
||||
Item {
|
||||
id: top
|
||||
|
|
@ -45,7 +45,7 @@ Item {
|
|||
id: initialized
|
||||
scene.activeCamera: Camera3D { zoomLevel: 200 }
|
||||
scene.devicePixelRatio: 2.0
|
||||
//scene.graphPositionQuery: Qt.point(0, 0) // TODO: Unusable until QTBUG-40043 is fixed
|
||||
scene.graphPositionQuery: Qt.point(0, 0)
|
||||
scene.primarySubViewport: Qt.rect(0, 0, 50, 50)
|
||||
scene.secondarySubViewport: Qt.rect(50, 50, 100, 100)
|
||||
scene.secondarySubviewOnTop: false
|
||||
|
|
@ -94,13 +94,22 @@ Item {
|
|||
function test_initialized() {
|
||||
compare(initialized.scene.activeCamera.zoomLevel, 200)
|
||||
compare(initialized.scene.devicePixelRatio, 2.0)
|
||||
//compare(initialized.scene.graphPositionQuery, Qt.point(0, 0)) // TODO: Unusable until QTBUG-40043 is fixed
|
||||
compare(initialized.scene.primarySubViewport, Qt.rect(0, 0, 50, 50))
|
||||
compare(initialized.scene.secondarySubViewport, Qt.rect(50, 50, 100, 100))
|
||||
compare(initialized.scene.graphPositionQuery, Qt.point(0, 0))
|
||||
compare(initialized.scene.primarySubViewport.x, 0)
|
||||
compare(initialized.scene.primarySubViewport.y, 0)
|
||||
compare(initialized.scene.primarySubViewport.width, 50)
|
||||
compare(initialized.scene.primarySubViewport.height, 50)
|
||||
compare(initialized.scene.secondarySubViewport.x, 50)
|
||||
compare(initialized.scene.secondarySubViewport.y, 50)
|
||||
compare(initialized.scene.secondarySubViewport.width, 100)
|
||||
compare(initialized.scene.secondarySubViewport.height, 100)
|
||||
compare(initialized.scene.secondarySubviewOnTop, false)
|
||||
compare(initialized.scene.selectionQueryPosition, Qt.point(0, 0))
|
||||
compare(initialized.scene.slicingActive, true)
|
||||
compare(initialized.scene.viewport, Qt.rect(0, 0, 150, 150))
|
||||
compare(initialized.scene.viewport.x, 0)
|
||||
compare(initialized.scene.viewport.y, 0)
|
||||
compare(initialized.scene.viewport.width, 150)
|
||||
compare(initialized.scene.viewport.height, 150)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -125,12 +134,21 @@ Item {
|
|||
compare(change.scene.activeCamera.zoomLevel, 200)
|
||||
compare(change.scene.devicePixelRatio, 2.0)
|
||||
compare(change.scene.graphPositionQuery, Qt.point(0, 0))
|
||||
compare(change.scene.primarySubViewport, Qt.rect(0, 0, 50, 50))
|
||||
compare(change.scene.secondarySubViewport, Qt.rect(50, 50, 100, 100))
|
||||
compare(change.scene.primarySubViewport.x, 0)
|
||||
compare(change.scene.primarySubViewport.y, 0)
|
||||
compare(change.scene.primarySubViewport.width, 50)
|
||||
compare(change.scene.primarySubViewport.height, 50)
|
||||
compare(change.scene.secondarySubViewport.x, 50)
|
||||
compare(change.scene.secondarySubViewport.y, 50)
|
||||
compare(change.scene.secondarySubViewport.width, 100)
|
||||
compare(change.scene.secondarySubViewport.height, 100)
|
||||
compare(change.scene.secondarySubviewOnTop, false)
|
||||
compare(change.scene.selectionQueryPosition, Qt.point(0, 0))
|
||||
compare(change.scene.slicingActive, true)
|
||||
compare(change.scene.viewport, Qt.rect(0, 0, 150, 150))
|
||||
compare(change.scene.viewport.x, 0)
|
||||
compare(change.scene.viewport.y, 0)
|
||||
compare(change.scene.viewport.width, 150)
|
||||
compare(change.scene.viewport.height, 150)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue