summaryrefslogtreecommitdiffstats
path: root/examples/datavisualization/bars
diff options
context:
space:
mode:
Diffstat (limited to 'examples/datavisualization/bars')
-rw-r--r--examples/datavisualization/bars/CMakeLists.txt41
-rw-r--r--examples/datavisualization/bars/bars.pro17
-rw-r--r--examples/datavisualization/bars/doc/images/bars-example.pngbin238712 -> 0 bytes
-rw-r--r--examples/datavisualization/bars/doc/src/bars.qdoc228
-rw-r--r--examples/datavisualization/bars/graphmodifier.cpp436
-rw-r--r--examples/datavisualization/bars/graphmodifier.h111
-rw-r--r--examples/datavisualization/bars/main.cpp337
7 files changed, 0 insertions, 1170 deletions
diff --git a/examples/datavisualization/bars/CMakeLists.txt b/examples/datavisualization/bars/CMakeLists.txt
deleted file mode 100644
index 5388c565..00000000
--- a/examples/datavisualization/bars/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-cmake_minimum_required(VERSION 3.14)
-project(bars LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS DataVisualization)
-
-qt_add_executable(bars
- graphmodifier.cpp graphmodifier.h
- main.cpp
-)
-set_target_properties(bars PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(bars PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
- Qt::DataVisualization
-)
-
-install(TARGETS bars
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/datavisualization/bars/bars.pro b/examples/datavisualization/bars/bars.pro
deleted file mode 100644
index 148fc66e..00000000
--- a/examples/datavisualization/bars/bars.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-android|ios|winrt {
- error( "This example is not supported for android, ios, or winrt." )
-}
-
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-SOURCES += main.cpp graphmodifier.cpp
-HEADERS += graphmodifier.h
-
-QT += widgets
-requires(qtConfig(fontcombobox))
-requires(qtConfig(combobox))
-
-OTHER_FILES += doc/src/* \
- doc/images/*
diff --git a/examples/datavisualization/bars/doc/images/bars-example.png b/examples/datavisualization/bars/doc/images/bars-example.png
deleted file mode 100644
index c06fe2c1..00000000
--- a/examples/datavisualization/bars/doc/images/bars-example.png
+++ /dev/null
Binary files differ
diff --git a/examples/datavisualization/bars/doc/src/bars.qdoc b/examples/datavisualization/bars/doc/src/bars.qdoc
deleted file mode 100644
index 1d2ad1ae..00000000
--- a/examples/datavisualization/bars/doc/src/bars.qdoc
+++ /dev/null
@@ -1,228 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example bars
- \title Bars Example
- \ingroup qtdatavisualization_examples
- \brief Using Q3DBars in a widget application.
-
- The bars example shows how to make a 3D bar graph using Q3DBars and combining the use of
- widgets for adjusting several adjustable qualities. The example shows how to:
-
- \list
- \li Create an application with Q3DBars and some widgets
- \li Use QBar3DSeries and QBarDataProxy to set data to the graph
- \li Adjust some graph and series properties using widget controls
- \li Select a row or a column by clicking an axis label
- \endlist
-
- It also demonstrates how having negative bar values affects the graph.
-
- For instructions about how to interact with the graph, see \l{Qt Data Visualization Interacting with Data}{this page}.
-
- \image bars-example.png
-
- \include examples-run.qdocinc
-
- \section1 Creating the Application
-
- First, in main.cpp, we create a QApplication, instantiate Q3DBars and a window container
- for it:
-
- \snippet bars/main.cpp 0
-
- The call to QWidget::createWindowContainer is required, as all data visualization graph classes
- (Q3DBars, Q3DScatter, Q3DSurface) inherit QWindow. Any class inheriting QWindow cannot be used
- as a widget any other way.
-
- Then we'll create horizontal and vertical layouts. We'll add the graph and the vertical
- layout into the horizontal one:
-
- \snippet bars/main.cpp 1
-
- We're not using the vertical layout for anything yet, but we'll get back to it in
- \l {Using widgets to control the graph}
-
- Next, let's create another class to handle the data addition and other interaction with the
- graph. Let's call it \c GraphModifier (See \l {Setting up the graph} and
- \l {Adding data to the graph} for details):
-
- \snippet bars/main.cpp 2
-
- The application main is done and we can show the graph and start the event loop:
-
- \snippet bars/main.cpp 3
-
- \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:
-
- \snippet bars/graphmodifier.cpp 0
-
- Let's take a closer look at parts of the code.
-
- First we're creating the axes and the series into member variables to support changing them
- easily later on, if we want to:
-
- \snippet bars/graphmodifier.cpp 1
-
- Then we're setting some of the visual qualities for the graph:
-
- \snippet bars/graphmodifier.cpp 2
-
- We're also setting up the axes and setting them to the graph as active axes:
-
- \snippet bars/graphmodifier.cpp 3
-
- We give axis labels a small autorotation angle to make them orient somewhat toward the
- camera. This is done to improve axis label readability at extreme camera angles.
-
- Next we initialize the visual properties of the series.
- Note that the second series is initially not visible:
-
- \snippet bars/graphmodifier.cpp 8
-
- The series need to be added to the graph to show them:
-
- \snippet bars/graphmodifier.cpp 4
-
- Finally, we set the camera angle by calling the same method the camera angle change button
- in the UI uses to cycle through various camera angles:
-
- \snippet bars/graphmodifier.cpp 6
-
- There you can see that the camera is controlled via the scene object of the graph:
-
- \snippet bars/graphmodifier.cpp 10
-
- For more information about using scene and cameras, see Q3DScene and Q3DCamera.
-
- That concludes setting up the graph.
-
- \section1 Adding Data to the Graph
-
- At the end of the constructor there's a call:
-
- \snippet bars/graphmodifier.cpp 9
-
- This method is used to add data to the proxies of the two series:
-
- \snippet bars/graphmodifier.cpp 5
-
- Now the series have data to show.
-
- \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:
-
- \snippet bars/main.cpp 4
-
- We can use these slider widgets to rotate the graph instead of just using the mouse or
- touch.
-
- Let's add them to the vertical layout we created earlier:
-
- \snippet bars/main.cpp 5
-
- Then we'll connect them to methods in \c GraphModifier:
-
- \snippet bars/main.cpp 6
-
- Here are the methods in \c GraphModifier the signals were connected to. The camera
- is controlled via the scene object. This time we specify the actual camera position
- along the orbit around the center point, instead of specifying a preset camera angle:
-
- \snippet bars/graphmodifier.cpp 7
-
- Now these two sliders can be used to rotate the graph.
-
- And so we have an application in which we can control:
-
- \list
- \li Graph rotation
- \li Label style
- \li Camera preset
- \li Background visibility
- \li Grid visibility
- \li Bar shading smoothness
- \li Visibility of the second bar series
- \li Value axis direction
- \li Axis title visibility and rotation
- \li Data range to be shown
- \li Bar style
- \li Selection mode
- \li Theme
- \li Shadow quality
- \li Font
- \li Font size
- \li Axis label rotation
- \endlist
-
- \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:
-
- \list
- \li Change selection mode to \c SelectionRow
- \li Click a year label
- \li The row with the clicked year is selected
- \endlist
-
- 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
-
- 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:
-
- \snippet bars/graphmodifier.cpp 12
-
- The function \c{GraphModifier::zoomToSelectedBar()} contains the rest of the functionality:
-
- \snippet bars/graphmodifier.cpp 11
-
- The QPropertyAnimation \c m_animationCameraTarget targets Q3DCamera::target property,
- which takes a value normalized to the range (-1, 1). We figure out where the selected bar
- is relative to axes, and use that as the end value for \c{m_animationCameraTarget}:
-
- \snippet bars/graphmodifier.cpp 13
- \dots
- \snippet bars/graphmodifier.cpp 14
-
- Likewise, we want to angle the camera so that it always points approximately to the center of
- the graph at the end of the animation:
-
- \snippet bars/graphmodifier.cpp 15
-
- \section1 Example Contents
-
-*/
diff --git a/examples/datavisualization/bars/graphmodifier.cpp b/examples/datavisualization/bars/graphmodifier.cpp
deleted file mode 100644
index 9a187620..00000000
--- a/examples/datavisualization/bars/graphmodifier.cpp
+++ /dev/null
@@ -1,436 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Data Visualization module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "graphmodifier.h"
-#include <QtDataVisualization/qcategory3daxis.h>
-#include <QtDataVisualization/qvalue3daxis.h>
-#include <QtDataVisualization/qbardataproxy.h>
-#include <QtDataVisualization/q3dscene.h>
-#include <QtDataVisualization/q3dcamera.h>
-#include <QtDataVisualization/qbar3dseries.h>
-#include <QtDataVisualization/q3dtheme.h>
-#include <QtCore/QTime>
-#include <QtWidgets/QComboBox>
-#include <QtCore/qmath.h>
-
-const QString celsiusString = QString(QChar(0xB0)) + "C";
-
-//! [0]
-GraphModifier::GraphModifier(Q3DBars *bargraph)
- : m_graph(bargraph),
- m_xRotation(0.0f),
- m_yRotation(0.0f),
- m_fontSize(30),
- m_segments(4),
- m_subSegments(3),
- m_minval(-20.0f),
- m_maxval(20.0f),
- //! [1]
- m_temperatureAxis(new QValue3DAxis),
- m_yearAxis(new QCategory3DAxis),
- m_monthAxis(new QCategory3DAxis),
- m_primarySeries(new QBar3DSeries),
- m_secondarySeries(new QBar3DSeries),
- //! [1]
- m_barMesh(QAbstract3DSeries::MeshBevelBar),
- m_smooth(false)
-{
- //! [2]
- m_graph->setShadowQuality(QAbstract3DGraph::ShadowQualitySoftMedium);
- m_graph->activeTheme()->setBackgroundEnabled(false);
- m_graph->activeTheme()->setFont(QFont("Times New Roman", m_fontSize));
- m_graph->activeTheme()->setLabelBackgroundEnabled(true);
- m_graph->setMultiSeriesUniform(true);
- //! [2]
-
- m_months << "January" << "February" << "March" << "April" << "May" << "June" << "July" << "August" << "September" << "October" << "November" << "December";
- m_years << "2006" << "2007" << "2008" << "2009" << "2010" << "2011" << "2012" << "2013";
-
- //! [3]
- m_temperatureAxis->setTitle("Average temperature");
- m_temperatureAxis->setSegmentCount(m_segments);
- m_temperatureAxis->setSubSegmentCount(m_subSegments);
- m_temperatureAxis->setRange(m_minval, m_maxval);
- m_temperatureAxis->setLabelFormat(QString(QStringLiteral("%.1f ") + celsiusString));
- m_temperatureAxis->setLabelAutoRotation(30.0f);
- m_temperatureAxis->setTitleVisible(true);
-
- m_yearAxis->setTitle("Year");
- m_yearAxis->setLabelAutoRotation(30.0f);
- m_yearAxis->setTitleVisible(true);
- m_monthAxis->setTitle("Month");
- m_monthAxis->setLabelAutoRotation(30.0f);
- m_monthAxis->setTitleVisible(true);
-
- m_graph->setValueAxis(m_temperatureAxis);
- m_graph->setRowAxis(m_yearAxis);
- m_graph->setColumnAxis(m_monthAxis);
- //! [3]
-
- //! [8]
- m_primarySeries->setItemLabelFormat(QStringLiteral("Oulu - @colLabel @rowLabel: @valueLabel"));
- m_primarySeries->setMesh(QAbstract3DSeries::MeshBevelBar);
- m_primarySeries->setMeshSmooth(false);
-
- m_secondarySeries->setItemLabelFormat(QStringLiteral("Helsinki - @colLabel @rowLabel: @valueLabel"));
- m_secondarySeries->setMesh(QAbstract3DSeries::MeshBevelBar);
- m_secondarySeries->setMeshSmooth(false);
- m_secondarySeries->setVisible(false);
- //! [8]
-
- //! [4]
- m_graph->addSeries(m_primarySeries);
- m_graph->addSeries(m_secondarySeries);
- //! [4]
-
- //! [6]
- changePresetCamera();
- //! [6]
-
- //! [9]
- resetTemperatureData();
- //! [9]
-
- // Set up property animations for zooming to the selected bar
- //! [12]
- Q3DCamera *camera = m_graph->scene()->activeCamera();
- m_defaultAngleX = camera->xRotation();
- m_defaultAngleY = camera->yRotation();
- m_defaultZoom = camera->zoomLevel();
- m_defaultTarget = camera->target();
-
- m_animationCameraX.setTargetObject(camera);
- m_animationCameraY.setTargetObject(camera);
- m_animationCameraZoom.setTargetObject(camera);
- m_animationCameraTarget.setTargetObject(camera);
-
- m_animationCameraX.setPropertyName("xRotation");
- m_animationCameraY.setPropertyName("yRotation");
- m_animationCameraZoom.setPropertyName("zoomLevel");
- m_animationCameraTarget.setPropertyName("target");
-
- int duration = 1700;
- m_animationCameraX.setDuration(duration);
- m_animationCameraY.setDuration(duration);
- m_animationCameraZoom.setDuration(duration);
- m_animationCameraTarget.setDuration(duration);
-
- // The zoom always first zooms out above the graph and then zooms in
- qreal zoomOutFraction = 0.3;
- m_animationCameraX.setKeyValueAt(zoomOutFraction, QVariant::fromValue(0.0f));
- m_animationCameraY.setKeyValueAt(zoomOutFraction, QVariant::fromValue(90.0f));
- m_animationCameraZoom.setKeyValueAt(zoomOutFraction, QVariant::fromValue(50.0f));
- m_animationCameraTarget.setKeyValueAt(zoomOutFraction,
- QVariant::fromValue(QVector3D(0.0f, 0.0f, 0.0f)));
- //! [12]
-}
-//! [0]
-
-GraphModifier::~GraphModifier()
-{
- delete m_graph;
-}
-
-void GraphModifier::resetTemperatureData()
-{
- //! [5]
- // Set up data
- static const float tempOulu[8][12] = {
- {-6.7f, -11.7f, -9.7f, 3.3f, 9.2f, 14.0f, 16.3f, 17.8f, 10.2f, 2.1f, -2.6f, -0.3f}, // 2006
- {-6.8f, -13.3f, 0.2f, 1.5f, 7.9f, 13.4f, 16.1f, 15.5f, 8.2f, 5.4f, -2.6f, -0.8f}, // 2007
- {-4.2f, -4.0f, -4.6f, 1.9f, 7.3f, 12.5f, 15.0f, 12.8f, 7.6f, 5.1f, -0.9f, -1.3f}, // 2008
- {-7.8f, -8.8f, -4.2f, 0.7f, 9.3f, 13.2f, 15.8f, 15.5f, 11.2f, 0.6f, 0.7f, -8.4f}, // 2009
- {-14.4f, -12.1f, -7.0f, 2.3f, 11.0f, 12.6f, 18.8f, 13.8f, 9.4f, 3.9f, -5.6f, -13.0f}, // 2010
- {-9.0f, -15.2f, -3.8f, 2.6f, 8.3f, 15.9f, 18.6f, 14.9f, 11.1f, 5.3f, 1.8f, -0.2f}, // 2011
- {-8.7f, -11.3f, -2.3f, 0.4f, 7.5f, 12.2f, 16.4f, 14.1f, 9.2f, 3.1f, 0.3f, -12.1f}, // 2012
- {-7.9f, -5.3f, -9.1f, 0.8f, 11.6f, 16.6f, 15.9f, 15.5f, 11.2f, 4.0f, 0.1f, -1.9f} // 2013
- };
-
- static const float tempHelsinki[8][12] = {
- {-3.7f, -7.8f, -5.4f, 3.4f, 10.7f, 15.4f, 18.6f, 18.7f, 14.3f, 8.5f, 2.9f, 4.1f}, // 2006
- {-1.2f, -7.5f, 3.1f, 5.5f, 10.3f, 15.9f, 17.4f, 17.9f, 11.2f, 7.3f, 1.1f, 0.5f}, // 2007
- {-0.6f, 1.2f, 0.2f, 6.3f, 10.2f, 13.8f, 18.1f, 15.1f, 10.1f, 9.4f, 2.5f, 0.4f}, // 2008
- {-2.9f, -3.5f, -0.9f, 4.7f, 10.9f, 14.0f, 17.4f, 16.8f, 13.2f, 4.1f, 2.6f, -2.3f}, // 2009
- {-10.2f, -8.0f, -1.9f, 6.6f, 11.3f, 14.5f, 21.0f, 18.8f, 12.6f, 6.1f, -0.5f, -7.3f}, // 2010
- {-4.4f, -9.1f, -2.0f, 5.5f, 9.9f, 15.6f, 20.8f, 17.8f, 13.4f, 8.9f, 3.6f, 1.5f}, // 2011
- {-3.5f, -3.2f, -0.7f, 4.0f, 11.1f, 13.4f, 17.3f, 15.8f, 13.1f, 6.4f, 4.1f, -5.1f}, // 2012
- {-4.8f, -1.8f, -5.0f, 2.9f, 12.8f, 17.2f, 18.0f, 17.1f, 12.5f, 7.5f, 4.5f, 2.3f} // 2013
- };
-
- // Create data arrays
- QBarDataArray *dataSet = new QBarDataArray;
- QBarDataArray *dataSet2 = new QBarDataArray;
- QBarDataRow *dataRow;
- QBarDataRow *dataRow2;
-
- dataSet->reserve(m_years.size());
- for (int year = 0; year < m_years.size(); year++) {
- // Create a data row
- dataRow = new QBarDataRow(m_months.size());
- dataRow2 = new QBarDataRow(m_months.size());
- for (int month = 0; month < m_months.size(); month++) {
- // Add data to the row
- (*dataRow)[month].setValue(tempOulu[year][month]);
- (*dataRow2)[month].setValue(tempHelsinki[year][month]);
- }
- // Add the row to the set
- dataSet->append(dataRow);
- dataSet2->append(dataRow2);
- }
-
- // Add data to the data proxy (the data proxy assumes ownership of it)
- m_primarySeries->dataProxy()->resetArray(dataSet, m_years, m_months);
- m_secondarySeries->dataProxy()->resetArray(dataSet2, m_years, m_months);
- //! [5]
-}
-
-void GraphModifier::changeRange(int range)
-{
- if (range >= m_years.count())
- m_yearAxis->setRange(0, m_years.count() - 1);
- else
- m_yearAxis->setRange(range, range);
-}
-
-void GraphModifier::changeStyle(int style)
-{
- QComboBox *comboBox = qobject_cast<QComboBox *>(sender());
- if (comboBox) {
- m_barMesh = QAbstract3DSeries::Mesh(comboBox->itemData(style).toInt());
- m_primarySeries->setMesh(m_barMesh);
- m_secondarySeries->setMesh(m_barMesh);
- }
-}
-
-void GraphModifier::changePresetCamera()
-{
- m_animationCameraX.stop();
- m_animationCameraY.stop();
- m_animationCameraZoom.stop();
- m_animationCameraTarget.stop();
-
- // Restore camera target in case animation has changed it
- m_graph->scene()->activeCamera()->setTarget(QVector3D(0.0f, 0.0f, 0.0f));
-
- //! [10]
- static int preset = Q3DCamera::CameraPresetFront;
-
- m_graph->scene()->activeCamera()->setCameraPreset((Q3DCamera::CameraPreset)preset);
-
- if (++preset > Q3DCamera::CameraPresetDirectlyBelow)
- preset = Q3DCamera::CameraPresetFrontLow;
- //! [10]
-}
-
-void GraphModifier::changeTheme(int theme)
-{
- Q3DTheme *currentTheme = m_graph->activeTheme();
- currentTheme->setType(Q3DTheme::Theme(theme));
- emit backgroundEnabledChanged(currentTheme->isBackgroundEnabled());
- emit gridEnabledChanged(currentTheme->isGridEnabled());
- emit fontChanged(currentTheme->font());
- emit fontSizeChanged(currentTheme->font().pointSize());
-}
-
-void GraphModifier::changeLabelBackground()
-{
- m_graph->activeTheme()->setLabelBackgroundEnabled(!m_graph->activeTheme()->isLabelBackgroundEnabled());
-}
-
-void GraphModifier::changeSelectionMode(int selectionMode)
-{
- QComboBox *comboBox = qobject_cast<QComboBox *>(sender());
- if (comboBox) {
- int flags = comboBox->itemData(selectionMode).toInt();
- m_graph->setSelectionMode(QAbstract3DGraph::SelectionFlags(flags));
- }
-}
-
-void GraphModifier::changeFont(const QFont &font)
-{
- QFont newFont = font;
- m_graph->activeTheme()->setFont(newFont);
-}
-
-void GraphModifier::changeFontSize(int fontsize)
-{
- m_fontSize = fontsize;
- QFont font = m_graph->activeTheme()->font();
- font.setPointSize(m_fontSize);
- m_graph->activeTheme()->setFont(font);
-}
-
-void GraphModifier::shadowQualityUpdatedByVisual(QAbstract3DGraph::ShadowQuality sq)
-{
- int quality = int(sq);
- // Updates the UI component to show correct shadow quality
- emit shadowQualityChanged(quality);
-}
-
-void GraphModifier::changeLabelRotation(int rotation)
-{
- m_temperatureAxis->setLabelAutoRotation(float(rotation));
- m_monthAxis->setLabelAutoRotation(float(rotation));
- m_yearAxis->setLabelAutoRotation(float(rotation));
-}
-
-void GraphModifier::setAxisTitleVisibility(bool enabled)
-{
- m_temperatureAxis->setTitleVisible(enabled);
- m_monthAxis->setTitleVisible(enabled);
- m_yearAxis->setTitleVisible(enabled);
-}
-
-void GraphModifier::setAxisTitleFixed(bool enabled)
-{
- m_temperatureAxis->setTitleFixed(enabled);
- m_monthAxis->setTitleFixed(enabled);
- m_yearAxis->setTitleFixed(enabled);
-}
-
-//! [11]
-void GraphModifier::zoomToSelectedBar()
-{
- m_animationCameraX.stop();
- m_animationCameraY.stop();
- m_animationCameraZoom.stop();
- m_animationCameraTarget.stop();
-
- Q3DCamera *camera = m_graph->scene()->activeCamera();
- float currentX = camera->xRotation();
- float currentY = camera->yRotation();
- float currentZoom = camera->zoomLevel();
- QVector3D currentTarget = camera->target();
-
- m_animationCameraX.setStartValue(QVariant::fromValue(currentX));
- m_animationCameraY.setStartValue(QVariant::fromValue(currentY));
- m_animationCameraZoom.setStartValue(QVariant::fromValue(currentZoom));
- m_animationCameraTarget.setStartValue(QVariant::fromValue(currentTarget));
-
- QPoint selectedBar = m_graph->selectedSeries()
- ? m_graph->selectedSeries()->selectedBar()
- : QBar3DSeries::invalidSelectionPosition();
-
- if (selectedBar != QBar3DSeries::invalidSelectionPosition()) {
- // Normalize selected bar position within axis range to determine target coordinates
- //! [13]
- QVector3D endTarget;
- float xMin = m_graph->columnAxis()->min();
- float xRange = m_graph->columnAxis()->max() - xMin;
- float zMin = m_graph->rowAxis()->min();
- float zRange = m_graph->rowAxis()->max() - zMin;
- endTarget.setX((selectedBar.y() - xMin) / xRange * 2.0f - 1.0f);
- endTarget.setZ((selectedBar.x() - zMin) / zRange * 2.0f - 1.0f);
- //! [13]
-
- // Rotate the camera so that it always points approximately to the graph center
- //! [15]
- qreal endAngleX = 90.0 - qRadiansToDegrees(qAtan(qreal(endTarget.z() / endTarget.x())));
- if (endTarget.x() > 0.0f)
- endAngleX -= 180.0f;
- float barValue = m_graph->selectedSeries()->dataProxy()->itemAt(selectedBar.x(),
- selectedBar.y())->value();
- float endAngleY = barValue >= 0.0f ? 30.0f : -30.0f;
- if (m_graph->valueAxis()->reversed())
- endAngleY *= -1.0f;
- //! [15]
-
- m_animationCameraX.setEndValue(QVariant::fromValue(float(endAngleX)));
- m_animationCameraY.setEndValue(QVariant::fromValue(endAngleY));
- m_animationCameraZoom.setEndValue(QVariant::fromValue(250));
- //! [14]
- m_animationCameraTarget.setEndValue(QVariant::fromValue(endTarget));
- //! [14]
- } else {
- // No selected bar, so return to the default view
- m_animationCameraX.setEndValue(QVariant::fromValue(m_defaultAngleX));
- m_animationCameraY.setEndValue(QVariant::fromValue(m_defaultAngleY));
- m_animationCameraZoom.setEndValue(QVariant::fromValue(m_defaultZoom));
- m_animationCameraTarget.setEndValue(QVariant::fromValue(m_defaultTarget));
- }
-
- m_animationCameraX.start();
- m_animationCameraY.start();
- m_animationCameraZoom.start();
- m_animationCameraTarget.start();
-}
-//! [11]
-
-void GraphModifier::changeShadowQuality(int quality)
-{
- QAbstract3DGraph::ShadowQuality sq = QAbstract3DGraph::ShadowQuality(quality);
- m_graph->setShadowQuality(sq);
- emit shadowQualityChanged(quality);
-}
-
-//! [7]
-void GraphModifier::rotateX(int rotation)
-{
- m_xRotation = rotation;
- m_graph->scene()->activeCamera()->setCameraPosition(m_xRotation, m_yRotation);
-}
-
-void GraphModifier::rotateY(int rotation)
-{
- m_yRotation = rotation;
- m_graph->scene()->activeCamera()->setCameraPosition(m_xRotation, m_yRotation);
-}
-//! [7]
-
-void GraphModifier::setBackgroundEnabled(int enabled)
-{
- m_graph->activeTheme()->setBackgroundEnabled(bool(enabled));
-}
-
-void GraphModifier::setGridEnabled(int enabled)
-{
- m_graph->activeTheme()->setGridEnabled(bool(enabled));
-}
-
-void GraphModifier::setSmoothBars(int smooth)
-{
- m_smooth = bool(smooth);
- m_primarySeries->setMeshSmooth(m_smooth);
- m_secondarySeries->setMeshSmooth(m_smooth);
-}
-
-void GraphModifier::setSeriesVisibility(int enabled)
-{
- m_secondarySeries->setVisible(bool(enabled));
-}
-
-void GraphModifier::setReverseValueAxis(int enabled)
-{
- m_graph->valueAxis()->setReversed(enabled);
-}
-
-void GraphModifier::setReflection(bool enabled)
-{
- m_graph->setReflection(enabled);
-}
diff --git a/examples/datavisualization/bars/graphmodifier.h b/examples/datavisualization/bars/graphmodifier.h
deleted file mode 100644
index b1420e33..00000000
--- a/examples/datavisualization/bars/graphmodifier.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Data Visualization module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef GRAPHMODIFIER_H
-#define GRAPHMODIFIER_H
-
-#include <QtDataVisualization/q3dbars.h>
-#include <QtDataVisualization/qbardataproxy.h>
-#include <QtDataVisualization/qabstract3dseries.h>
-
-#include <QtGui/QFont>
-#include <QtCore/QDebug>
-#include <QtCore/QStringList>
-#include <QtCore/QPointer>
-#include <QtCore/QPropertyAnimation>
-
-class GraphModifier : public QObject
-{
- Q_OBJECT
-public:
- explicit GraphModifier(Q3DBars *bargraph);
- ~GraphModifier();
-
- void resetTemperatureData();
- void changePresetCamera();
- void changeLabelBackground();
- void changeFont(const QFont &font);
- void changeFontSize(int fontsize);
- void rotateX(int rotation);
- void rotateY(int rotation);
- void setBackgroundEnabled(int enabled);
- void setGridEnabled(int enabled);
- void setSmoothBars(int smooth);
- void setSeriesVisibility(int enabled);
- void setReverseValueAxis(int enabled);
- void setReflection(bool enabled);
-
-public Q_SLOTS:
- void changeRange(int range);
- void changeStyle(int style);
- void changeSelectionMode(int selectionMode);
- void changeTheme(int theme);
- void changeShadowQuality(int quality);
- void shadowQualityUpdatedByVisual(QAbstract3DGraph::ShadowQuality shadowQuality);
- void changeLabelRotation(int rotation);
- void setAxisTitleVisibility(bool enabled);
- void setAxisTitleFixed(bool enabled);
- void zoomToSelectedBar();
-
-Q_SIGNALS:
- void shadowQualityChanged(int quality);
- void backgroundEnabledChanged(bool enabled);
- void gridEnabledChanged(bool enabled);
- void fontChanged(QFont font);
- void fontSizeChanged(int size);
-
-private:
- Q3DBars *m_graph;
- float m_xRotation;
- float m_yRotation;
- int m_fontSize;
- int m_segments;
- int m_subSegments;
- float m_minval;
- float m_maxval;
- QStringList m_months;
- QStringList m_years;
- QValue3DAxis *m_temperatureAxis;
- QCategory3DAxis *m_yearAxis;
- QCategory3DAxis *m_monthAxis;
- QBar3DSeries *m_primarySeries;
- QBar3DSeries *m_secondarySeries;
- QAbstract3DSeries::Mesh m_barMesh;
- bool m_smooth;
- QPropertyAnimation m_animationCameraX;
- QPropertyAnimation m_animationCameraY;
- QPropertyAnimation m_animationCameraZoom;
- QPropertyAnimation m_animationCameraTarget;
- float m_defaultAngleX;
- float m_defaultAngleY;
- float m_defaultZoom;
- QVector3D m_defaultTarget;
-};
-
-#endif
diff --git a/examples/datavisualization/bars/main.cpp b/examples/datavisualization/bars/main.cpp
deleted file mode 100644
index eaa7c61d..00000000
--- a/examples/datavisualization/bars/main.cpp
+++ /dev/null
@@ -1,337 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Data Visualization module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "graphmodifier.h"
-
-#include <QtWidgets/QApplication>
-#include <QtWidgets/QWidget>
-#include <QtWidgets/QHBoxLayout>
-#include <QtWidgets/QVBoxLayout>
-#include <QtWidgets/QPushButton>
-#include <QtWidgets/QCheckBox>
-#include <QtWidgets/QSlider>
-#include <QtWidgets/QFontComboBox>
-#include <QtWidgets/QLabel>
-#include <QtWidgets/QMessageBox>
-#include <QtGui/QScreen>
-#include <QtGui/QFontDatabase>
-
-int main(int argc, char **argv)
-{
- qputenv("QSG_RHI_BACKEND", "opengl");
- //! [0]
- QApplication app(argc, argv);
- Q3DBars *widgetgraph = new Q3DBars();
- QWidget *container = QWidget::createWindowContainer(widgetgraph);
- //! [0]
-
- if (!widgetgraph->hasContext()) {
- QMessageBox msgBox;
- msgBox.setText("Couldn't initialize the OpenGL context.");
- msgBox.exec();
- return -1;
- }
-
- QSize screenSize = widgetgraph->screen()->size();
- container->setMinimumSize(QSize(screenSize.width() / 2, screenSize.height() / 1.5));
- container->setMaximumSize(screenSize);
- container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- container->setFocusPolicy(Qt::StrongFocus);
-
- //! [1]
- QWidget *widget = new QWidget;
- QHBoxLayout *hLayout = new QHBoxLayout(widget);
- QVBoxLayout *vLayout = new QVBoxLayout();
- hLayout->addWidget(container, 1);
- hLayout->addLayout(vLayout);
- //! [1]
-
- widget->setWindowTitle(QStringLiteral("Average temperatures in Oulu and Helsinki, Finland (2006-2013)"));
-
- QComboBox *themeList = new QComboBox(widget);
- themeList->addItem(QStringLiteral("Qt"));
- themeList->addItem(QStringLiteral("Primary Colors"));
- themeList->addItem(QStringLiteral("Digia"));
- themeList->addItem(QStringLiteral("Stone Moss"));
- themeList->addItem(QStringLiteral("Army Blue"));
- themeList->addItem(QStringLiteral("Retro"));
- themeList->addItem(QStringLiteral("Ebony"));
- themeList->addItem(QStringLiteral("Isabelle"));
- themeList->setCurrentIndex(0);
-
- QPushButton *labelButton = new QPushButton(widget);
- labelButton->setText(QStringLiteral("Change label style"));
-
- QCheckBox *smoothCheckBox = new QCheckBox(widget);
- smoothCheckBox->setText(QStringLiteral("Smooth bars"));
- smoothCheckBox->setChecked(false);
-
-
- QComboBox *barStyleList = new QComboBox(widget);
- barStyleList->addItem(QStringLiteral("Bar"), int(QAbstract3DSeries::MeshBar));
- barStyleList->addItem(QStringLiteral("Pyramid"), int(QAbstract3DSeries::MeshPyramid));
- barStyleList->addItem(QStringLiteral("Cone"), int(QAbstract3DSeries::MeshCone));
- barStyleList->addItem(QStringLiteral("Cylinder"), int(QAbstract3DSeries::MeshCylinder));
- barStyleList->addItem(QStringLiteral("Bevel bar"), int(QAbstract3DSeries::MeshBevelBar));
- barStyleList->addItem(QStringLiteral("Sphere"), int(QAbstract3DSeries::MeshSphere));
- barStyleList->setCurrentIndex(4);
-
- QPushButton *cameraButton = new QPushButton(widget);
- cameraButton->setText(QStringLiteral("Change camera preset"));
-
- QPushButton *zoomToSelectedButton = new QPushButton(widget);
- zoomToSelectedButton->setText(QStringLiteral("Zoom to selected bar"));
-
- QComboBox *selectionModeList = new QComboBox(widget);
- selectionModeList->addItem(QStringLiteral("None"),
- int(QAbstract3DGraph::SelectionNone));
- selectionModeList->addItem(QStringLiteral("Bar"),
- int(QAbstract3DGraph::SelectionItem));
- selectionModeList->addItem(QStringLiteral("Row"),
- int(QAbstract3DGraph::SelectionRow));
- selectionModeList->addItem(QStringLiteral("Bar and Row"),
- int(QAbstract3DGraph::SelectionItemAndRow));
- selectionModeList->addItem(QStringLiteral("Column"),
- int(QAbstract3DGraph::SelectionColumn));
- selectionModeList->addItem(QStringLiteral("Bar and Column"),
- int(QAbstract3DGraph::SelectionItemAndColumn));
- selectionModeList->addItem(QStringLiteral("Row and Column"),
- int(QAbstract3DGraph::SelectionRowAndColumn));
- selectionModeList->addItem(QStringLiteral("Bar, Row and Column"),
- int(QAbstract3DGraph::SelectionItemRowAndColumn));
- selectionModeList->addItem(QStringLiteral("Slice into Row"),
- int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionRow));
- selectionModeList->addItem(QStringLiteral("Slice into Row and Item"),
- int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndRow));
- selectionModeList->addItem(QStringLiteral("Slice into Column"),
- int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionColumn));
- selectionModeList->addItem(QStringLiteral("Slice into Column and Item"),
- int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndColumn));
- selectionModeList->addItem(QStringLiteral("Multi: Bar, Row, Col"),
- int(QAbstract3DGraph::SelectionItemRowAndColumn
- | QAbstract3DGraph::SelectionMultiSeries));
- selectionModeList->addItem(QStringLiteral("Multi, Slice: Row, Item"),
- int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndRow
- | QAbstract3DGraph::SelectionMultiSeries));
- selectionModeList->addItem(QStringLiteral("Multi, Slice: Col, Item"),
- int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndColumn
- | QAbstract3DGraph::SelectionMultiSeries));
- selectionModeList->setCurrentIndex(1);
-
- QCheckBox *backgroundCheckBox = new QCheckBox(widget);
- backgroundCheckBox->setText(QStringLiteral("Show background"));
- backgroundCheckBox->setChecked(false);
-
- QCheckBox *gridCheckBox = new QCheckBox(widget);
- gridCheckBox->setText(QStringLiteral("Show grid"));
- gridCheckBox->setChecked(true);
-
- QCheckBox *seriesCheckBox = new QCheckBox(widget);
- seriesCheckBox->setText(QStringLiteral("Show second series"));
- seriesCheckBox->setChecked(false);
-
- QCheckBox *reverseValueAxisCheckBox = new QCheckBox(widget);
- reverseValueAxisCheckBox->setText(QStringLiteral("Reverse value axis"));
- reverseValueAxisCheckBox->setChecked(false);
-
- QCheckBox *reflectionCheckBox = new QCheckBox(widget);
- reflectionCheckBox->setText(QStringLiteral("Show reflections"));
- reflectionCheckBox->setChecked(false);
-
- //! [4]
- QSlider *rotationSliderX = new QSlider(Qt::Horizontal, widget);
- rotationSliderX->setTickInterval(30);
- rotationSliderX->setTickPosition(QSlider::TicksBelow);
- rotationSliderX->setMinimum(-180);
- rotationSliderX->setValue(0);
- rotationSliderX->setMaximum(180);
- QSlider *rotationSliderY = new QSlider(Qt::Horizontal, widget);
- rotationSliderY->setTickInterval(15);
- rotationSliderY->setTickPosition(QSlider::TicksAbove);
- rotationSliderY->setMinimum(-90);
- rotationSliderY->setValue(0);
- rotationSliderY->setMaximum(90);
- //! [4]
-
- QSlider *fontSizeSlider = new QSlider(Qt::Horizontal, widget);
- fontSizeSlider->setTickInterval(10);
- fontSizeSlider->setTickPosition(QSlider::TicksBelow);
- fontSizeSlider->setMinimum(1);
- fontSizeSlider->setValue(30);
- fontSizeSlider->setMaximum(100);
-
- QFontComboBox *fontList = new QFontComboBox(widget);
- fontList->setCurrentFont(QFont("Times New Roman"));
-
- QComboBox *shadowQuality = new QComboBox(widget);
- shadowQuality->addItem(QStringLiteral("None"));
- shadowQuality->addItem(QStringLiteral("Low"));
- shadowQuality->addItem(QStringLiteral("Medium"));
- shadowQuality->addItem(QStringLiteral("High"));
- shadowQuality->addItem(QStringLiteral("Low Soft"));
- shadowQuality->addItem(QStringLiteral("Medium Soft"));
- shadowQuality->addItem(QStringLiteral("High Soft"));
- shadowQuality->setCurrentIndex(5);
-
- QComboBox *rangeList = new QComboBox(widget);
- rangeList->addItem(QStringLiteral("2006"));
- rangeList->addItem(QStringLiteral("2007"));
- rangeList->addItem(QStringLiteral("2008"));
- rangeList->addItem(QStringLiteral("2009"));
- rangeList->addItem(QStringLiteral("2010"));
- rangeList->addItem(QStringLiteral("2011"));
- rangeList->addItem(QStringLiteral("2012"));
- rangeList->addItem(QStringLiteral("2013"));
- rangeList->addItem(QStringLiteral("All"));
- rangeList->setCurrentIndex(8);
-
- QCheckBox *axisTitlesVisibleCB = new QCheckBox(widget);
- axisTitlesVisibleCB->setText(QStringLiteral("Axis titles visible"));
- axisTitlesVisibleCB->setChecked(true);
-
- QCheckBox *axisTitlesFixedCB = new QCheckBox(widget);
- axisTitlesFixedCB->setText(QStringLiteral("Axis titles fixed"));
- axisTitlesFixedCB->setChecked(true);
-
- QSlider *axisLabelRotationSlider = new QSlider(Qt::Horizontal, widget);
- axisLabelRotationSlider->setTickInterval(10);
- axisLabelRotationSlider->setTickPosition(QSlider::TicksBelow);
- axisLabelRotationSlider->setMinimum(0);
- axisLabelRotationSlider->setValue(30);
- axisLabelRotationSlider->setMaximum(90);
-
- //! [5]
- vLayout->addWidget(new QLabel(QStringLiteral("Rotate horizontally")));
- vLayout->addWidget(rotationSliderX, 0, Qt::AlignTop);
- vLayout->addWidget(new QLabel(QStringLiteral("Rotate vertically")));
- vLayout->addWidget(rotationSliderY, 0, Qt::AlignTop);
- //! [5]
- vLayout->addWidget(labelButton, 0, Qt::AlignTop);
- vLayout->addWidget(cameraButton, 0, Qt::AlignTop);
- vLayout->addWidget(zoomToSelectedButton, 0, Qt::AlignTop);
- vLayout->addWidget(backgroundCheckBox);
- vLayout->addWidget(gridCheckBox);
- vLayout->addWidget(smoothCheckBox);
- vLayout->addWidget(reflectionCheckBox);
- vLayout->addWidget(seriesCheckBox);
- vLayout->addWidget(reverseValueAxisCheckBox);
- vLayout->addWidget(axisTitlesVisibleCB);
- vLayout->addWidget(axisTitlesFixedCB);
- vLayout->addWidget(new QLabel(QStringLiteral("Show year")));
- vLayout->addWidget(rangeList);
- vLayout->addWidget(new QLabel(QStringLiteral("Change bar style")));
- vLayout->addWidget(barStyleList);
- vLayout->addWidget(new QLabel(QStringLiteral("Change selection mode")));
- vLayout->addWidget(selectionModeList);
- vLayout->addWidget(new QLabel(QStringLiteral("Change theme")));
- vLayout->addWidget(themeList);
- vLayout->addWidget(new QLabel(QStringLiteral("Adjust shadow quality")));
- vLayout->addWidget(shadowQuality);
- vLayout->addWidget(new QLabel(QStringLiteral("Change font")));
- vLayout->addWidget(fontList);
- vLayout->addWidget(new QLabel(QStringLiteral("Adjust font size")));
- vLayout->addWidget(fontSizeSlider);
- vLayout->addWidget(new QLabel(QStringLiteral("Axis label rotation")));
- vLayout->addWidget(axisLabelRotationSlider, 1, Qt::AlignTop);
-
- //! [2]
- GraphModifier *modifier = new GraphModifier(widgetgraph);
- //! [2]
-
- //! [6]
- QObject::connect(rotationSliderX, &QSlider::valueChanged, modifier, &GraphModifier::rotateX);
- QObject::connect(rotationSliderY, &QSlider::valueChanged, modifier, &GraphModifier::rotateY);
- //! [6]
-
- QObject::connect(labelButton, &QPushButton::clicked, modifier,
- &GraphModifier::changeLabelBackground);
- QObject::connect(cameraButton, &QPushButton::clicked, modifier,
- &GraphModifier::changePresetCamera);
- QObject::connect(zoomToSelectedButton, &QPushButton::clicked, modifier,
- &GraphModifier::zoomToSelectedBar);
-
- QObject::connect(backgroundCheckBox, &QCheckBox::stateChanged, modifier,
- &GraphModifier::setBackgroundEnabled);
- QObject::connect(gridCheckBox, &QCheckBox::stateChanged, modifier,
- &GraphModifier::setGridEnabled);
- QObject::connect(smoothCheckBox, &QCheckBox::stateChanged, modifier,
- &GraphModifier::setSmoothBars);
- QObject::connect(seriesCheckBox, &QCheckBox::stateChanged, modifier,
- &GraphModifier::setSeriesVisibility);
- QObject::connect(reverseValueAxisCheckBox, &QCheckBox::stateChanged, modifier,
- &GraphModifier::setReverseValueAxis);
- QObject::connect(reflectionCheckBox, &QCheckBox::stateChanged, modifier,
- &GraphModifier::setReflection);
-
- QObject::connect(modifier, &GraphModifier::backgroundEnabledChanged,
- backgroundCheckBox, &QCheckBox::setChecked);
- QObject::connect(modifier, &GraphModifier::gridEnabledChanged,
- gridCheckBox, &QCheckBox::setChecked);
-
- QObject::connect(rangeList, SIGNAL(currentIndexChanged(int)), modifier,
- SLOT(changeRange(int)));
-
- QObject::connect(barStyleList, SIGNAL(currentIndexChanged(int)), modifier,
- SLOT(changeStyle(int)));
-
- QObject::connect(selectionModeList, SIGNAL(currentIndexChanged(int)), modifier,
- SLOT(changeSelectionMode(int)));
-
- QObject::connect(themeList, SIGNAL(currentIndexChanged(int)), modifier,
- SLOT(changeTheme(int)));
-
- QObject::connect(shadowQuality, SIGNAL(currentIndexChanged(int)), modifier,
- SLOT(changeShadowQuality(int)));
-
- QObject::connect(modifier, &GraphModifier::shadowQualityChanged, shadowQuality,
- &QComboBox::setCurrentIndex);
- QObject::connect(widgetgraph, &Q3DBars::shadowQualityChanged, modifier,
- &GraphModifier::shadowQualityUpdatedByVisual);
-
- QObject::connect(fontSizeSlider, &QSlider::valueChanged, modifier,
- &GraphModifier::changeFontSize);
- QObject::connect(fontList, &QFontComboBox::currentFontChanged, modifier,
- &GraphModifier::changeFont);
-
- QObject::connect(modifier, &GraphModifier::fontSizeChanged, fontSizeSlider,
- &QSlider::setValue);
- QObject::connect(modifier, &GraphModifier::fontChanged, fontList,
- &QFontComboBox::setCurrentFont);
-
- QObject::connect(axisTitlesVisibleCB, &QCheckBox::stateChanged, modifier,
- &GraphModifier::setAxisTitleVisibility);
- QObject::connect(axisTitlesFixedCB, &QCheckBox::stateChanged, modifier,
- &GraphModifier::setAxisTitleFixed);
- QObject::connect(axisLabelRotationSlider, &QSlider::valueChanged, modifier,
- &GraphModifier::changeLabelRotation);
- //! [3]
- widget->show();
- return app.exec();
- //! [3]
-}