diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-10-16 11:27:33 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-10-16 11:27:33 +0300 |
commit | df8c7a37aee9a78de310bcb05e2eb0097ef4afb7 (patch) | |
tree | 35b3c7a600ce420b4c3289b198db28959f61221e | |
parent | ca476759926f3315fc9325c5fb42a0dee9d8227e (diff) | |
parent | d1807d099e1852e902770345c6a14912b4f2d175 (diff) |
Merge remote-tracking branch 'origin/develop'
Change-Id: I74291fecb2c553ebd796848670b2b7782378efb2
40 files changed, 360 insertions, 113 deletions
diff --git a/.gitattributes b/.gitattributes index 7709f882..26f7dd27 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,3 +3,4 @@ .gitattributes export-ignore .commit-template export-ignore tests export-ignore +tools export-ignore @@ -13,12 +13,32 @@ System Requirements Building ======== -Configure project with qmake and build project with make: +Configure the project with qmake: + qmake + +After running qmake, build the project with make: (Linux) make (Windows with MinGw) mingw32-make (Visual Studio) nmake (OSX) make +The above generates the default makefiles for your configuration, which is typically +the release build if you are using precompiled binary Qt distribution. To build both +debug and release, or one specifically, use one of the following qmake lines instead. + +For debug builds: + qmake CONFIG+=debug; make + or + qmake CONFIG+=debug_and_release; make debug + +For release builds: + qmake CONFIG+=release ; make + or + qmake CONFIG+=debug_and_release; make release + +For both builds + qmake CONFIG+="debug_and_release build_all"; make + If you want to install the module to your Qt directory use: make install @@ -59,3 +79,4 @@ others may be only partially implemented. Here are some known issues: - Android doesn't support both widgets and OpenGL simulataneously, so only the Qt Quick 2 API is usable in practice in Android. - Shadows are not supported with OpenGL ES2 (including Angle builds in Windows). +- Anti-aliasing doesn't work with OpenGL ES2 (including Angle builds in Windows). diff --git a/examples/audiolevels/doc/images/audiolevels-example.png b/examples/audiolevels/doc/images/audiolevels-example.png Binary files differindex 47c982d9..c6e12d09 100644 --- a/examples/audiolevels/doc/images/audiolevels-example.png +++ b/examples/audiolevels/doc/images/audiolevels-example.png diff --git a/examples/bars/doc/images/bars-example.png b/examples/bars/doc/images/bars-example.png Binary files differindex fb30a944..e8b91314 100644 --- a/examples/bars/doc/images/bars-example.png +++ b/examples/bars/doc/images/bars-example.png diff --git a/examples/customproxy/doc/images/customproxy-example.png b/examples/customproxy/doc/images/customproxy-example.png Binary files differindex f1b5c443..3dc65bbb 100644 --- a/examples/customproxy/doc/images/customproxy-example.png +++ b/examples/customproxy/doc/images/customproxy-example.png diff --git a/examples/itemmodel/doc/images/itemmodel-example-2.png b/examples/itemmodel/doc/images/itemmodel-example-2.png Binary files differindex 7186b267..f8a0535a 100644 --- a/examples/itemmodel/doc/images/itemmodel-example-2.png +++ b/examples/itemmodel/doc/images/itemmodel-example-2.png diff --git a/examples/itemmodel/doc/images/itemmodel-example.png b/examples/itemmodel/doc/images/itemmodel-example.png Binary files differindex 03d7c386..68a4d970 100644 --- a/examples/itemmodel/doc/images/itemmodel-example.png +++ b/examples/itemmodel/doc/images/itemmodel-example.png diff --git a/examples/itemmodel/main.cpp b/examples/itemmodel/main.cpp index 6ab685ed..fac6b442 100644 --- a/examples/itemmodel/main.cpp +++ b/examples/itemmodel/main.cpp @@ -159,7 +159,7 @@ void GraphDataGenerator::setupModel() weeks << "week 1" << "week 2" << "week 3" << "week 4" << "week 5"; // Set up data Mon Tue Wed Thu Fri Sat Sun - float hours[5][7] = {{2.0, 1.0, 3.0, 0.2, 1.0, 5.0, 10.0}, // week 1 + qreal hours[5][7] = {{2.0, 1.0, 3.0, 0.2, 1.0, 5.0, 10.0}, // week 1 {0.5, 1.0, 3.0, 1.0, 2.0, 2.0, 3.0}, // week 2 {1.0, 1.0, 2.0, 1.0, 4.0, 4.0, 4.0}, // week 3 {0.0, 1.0, 0.0, 0.0, 2.0, 2.0, 0.3}, // week 4 diff --git a/examples/qmlbars/doc/images/qmlbars-example.png b/examples/qmlbars/doc/images/qmlbars-example.png Binary files differindex b23491e9..159b9b7c 100644 --- a/examples/qmlbars/doc/images/qmlbars-example.png +++ b/examples/qmlbars/doc/images/qmlbars-example.png diff --git a/examples/qmlscatter/doc/images/qmlscatter-example.png b/examples/qmlscatter/doc/images/qmlscatter-example.png Binary files differindex 039c1efc..7ba226fe 100644 --- a/examples/qmlscatter/doc/images/qmlscatter-example.png +++ b/examples/qmlscatter/doc/images/qmlscatter-example.png diff --git a/examples/qmlscatter/doc/images/qmlscatter-newproject.png b/examples/qmlscatter/doc/images/qmlscatter-newproject.png Binary files differindex b64e6fc6..32ce2e1c 100644 --- a/examples/qmlscatter/doc/images/qmlscatter-newproject.png +++ b/examples/qmlscatter/doc/images/qmlscatter-newproject.png diff --git a/examples/qmlsurface/doc/images/qmlsurface-example.png b/examples/qmlsurface/doc/images/qmlsurface-example.png Binary files differindex 32396b40..85350b5a 100644 --- a/examples/qmlsurface/doc/images/qmlsurface-example.png +++ b/examples/qmlsurface/doc/images/qmlsurface-example.png diff --git a/examples/qmlsurface/qml/qmlsurface/main.qml b/examples/qmlsurface/qml/qmlsurface/main.qml index 160fa9b6..bc8d9499 100644 --- a/examples/qmlsurface/qml/qmlsurface/main.qml +++ b/examples/qmlsurface/qml/qmlsurface/main.qml @@ -70,6 +70,17 @@ Item { axisY.subSegmentCount: 2 axisY.labelFormat: "%i" gradient: surfaceGradient + + // Since flat is not supported on all platforms, and changes back to smooth + // asynchronously on those platforms, handle button text on changed + // signal handler rather than when we set the value. + onSmoothSurfaceEnabledChanged: { + if (enabled === true) { + smoothSurfaceToggle.text = "Show Flat" + } else { + smoothSurfaceToggle.text = "Show Smooth" + } + } } } @@ -81,7 +92,7 @@ Item { text: "Show Surface Grid" //! [1] onClicked: { - if (surfaceplot.surfaceGridEnabled == false) { + if (surfaceplot.surfaceGridEnabled === false) { surfaceplot.surfaceGridEnabled = true; text = "Hide Surface Grid" } else { @@ -99,12 +110,10 @@ Item { text: "Show Flat" //! [2] onClicked: { - if (surfaceplot.smoothSurfaceEnabled == true) { + if (surfaceplot.smoothSurfaceEnabled === true) { surfaceplot.smoothSurfaceEnabled = false; - text = "Show Smooth" } else { surfaceplot.smoothSurfaceEnabled = true; - text = "Show Flat" } } //! [2] @@ -116,7 +125,7 @@ Item { width: smoothSurfaceToggle.width text: "Hide Background" onClicked: { - if (surfaceplot.backgroundVisible == true) { + if (surfaceplot.backgroundVisible === true) { surfaceplot.backgroundVisible = false; text = "Show Background" } else { @@ -132,7 +141,7 @@ Item { width: backgroundToggle.width text: "Hide Grid" onClicked: { - if (surfaceplot.gridVisible == true) { + if (surfaceplot.gridVisible === true) { surfaceplot.gridVisible = false; text = "Show Grid" } else { diff --git a/examples/scatter/doc/images/scatter-example.png b/examples/scatter/doc/images/scatter-example.png Binary files differindex d5331e4d..1403705c 100644 --- a/examples/scatter/doc/images/scatter-example.png +++ b/examples/scatter/doc/images/scatter-example.png diff --git a/examples/surface/doc/images/surface-example.png b/examples/surface/doc/images/surface-example.png Binary files differindex 591f9c1e..77c1f900 100644 --- a/examples/surface/doc/images/surface-example.png +++ b/examples/surface/doc/images/surface-example.png diff --git a/src/datavisualization/doc/images/q3dbars-minimal.png b/src/datavisualization/doc/images/q3dbars-minimal.png Binary files differindex fff8d415..21dcf5b3 100644 --- a/src/datavisualization/doc/images/q3dbars-minimal.png +++ b/src/datavisualization/doc/images/q3dbars-minimal.png diff --git a/src/datavisualization/doc/images/q3dscatter-minimal.png b/src/datavisualization/doc/images/q3dscatter-minimal.png Binary files differindex 1c3290b3..fc5f8c62 100644 --- a/src/datavisualization/doc/images/q3dscatter-minimal.png +++ b/src/datavisualization/doc/images/q3dscatter-minimal.png diff --git a/src/datavisualization/doc/images/q3dsurface-minimal.png b/src/datavisualization/doc/images/q3dsurface-minimal.png Binary files differindex 119cdfb9..2ef8b104 100644 --- a/src/datavisualization/doc/images/q3dsurface-minimal.png +++ b/src/datavisualization/doc/images/q3dsurface-minimal.png diff --git a/src/datavisualization/doc/qtdatavisualization.qdocconf b/src/datavisualization/doc/qtdatavisualization.qdocconf index 82a5d8c4..14dcb3cd 100644 --- a/src/datavisualization/doc/qtdatavisualization.qdocconf +++ b/src/datavisualization/doc/qtdatavisualization.qdocconf @@ -15,23 +15,34 @@ sourcedirs += .. depends += qtcore \ qtgui -qhp.projects = qtdatavisualization +qhp.projects = qtdatavisualization qhp.qtdatavisualization.file = qtdatavisualization.qhp -qhp.qtdatavisualization.namespace = org.qt-project.qtdatavisualization.0.1.0 +qhp.qtdatavisualization.namespace = com.digia.qtdatavisualization.010 qhp.qtdatavisualization.virtualFolder = qtdatavisualization qhp.qtdatavisualization.indexTitle = Qt Data Visualization qhp.qtdatavisualization.indexRoot = -qhp.qtdatavisualization.filterAttributes = qtdatavisualization 0.1.0 qtrefdoc -qhp.qtdatavisualization.customFilters.Qt.name = QtDataVisualization 0.1.0 -qhp.qtdatavisualization.customFilters.Qt.filterAttributes = qtdatavisualization 0.1.0 -qhp.qtdatavisualization.subprojects = classes -qhp.qtdatavisualization.subprojects.classes.title = C++ Classes -qhp.qtdatavisualization.subprojects.classes.indexTitle = Qt Data Visualization C++ Classes -qhp.qtdatavisualization.subprojects.classes.selectors = class fake:headerfile -qhp.qtdatavisualization.subprojects.classes.sortPages = true - +qhp.qtdatavisualization.filterAttributes = qtdatavisualization 0.1.0 qtrefdoc +qhp.qtdatavisualization.customFilters.Qt.name = QtDataVisualization 0.1.0 +qhp.qtdatavisualization.customFilters.Qt.filterAttributes = qtdatavisualization 0.1.0 +qhp.qtdatavisualization.subprojects = gettingstarted examples classes types +qhp.qtdatavisualization.subprojects.gettingstarted.title = Getting Started +qhp.qtdatavisualization.subprojects.gettingstarted.indexTitle = Qt Data Visualization Getting Started +qhp.qtdatavisualization.subprojects.gettingstarted.selectors = fake:page +qhp.qtdatavisualization.subprojects.gettingstarted.sortPages = true +qhp.qtdatavisualization.subprojects.examples.title = Examples +qhp.qtdatavisualization.subprojects.examples.indexTitle = Qt Data Visualization Examples +qhp.qtdatavisualization.subprojects.examples.selectors = fake:example +qhp.qtdatavisualization.subprojects.examples.sortPages = true +qhp.qtdatavisualization.subprojects.classes.title = C++ Classes +qhp.qtdatavisualization.subprojects.classes.indexTitle = Qt Data Visualization C++ Classes +qhp.qtdatavisualization.subprojects.classes.selectors = class +qhp.qtdatavisualization.subprojects.classes.sortPages = true +qhp.qtdatavisualization.subprojects.types.title = QML Types +qhp.qtdatavisualization.subprojects.types.indexTitle = Qt Data Visualization QML Types +qhp.qtdatavisualization.subprojects.types.selectors = class +qhp.qtdatavisualization.subprojects.types.sortPages = true HTML.footer = \ "<div class=\"footer\">\n" \ @@ -49,3 +60,9 @@ HTML.footer = \ " </p>\n" \ "</div>\n" +navigation.homepage = Qt Enterprise: +navigation.landingpage = Qt Data Visualization +navigation.cppclassespage = Qt Data Visualization C++ Classes +navigation.qmltypespage = Qt Data Visualization QML Types + +buildversion = Qt Data Visualization $QT_VERSION Reference Documentation diff --git a/src/datavisualization/doc/snippets/doc_src_q3dscatter_construction.cpp b/src/datavisualization/doc/snippets/doc_src_q3dscatter_construction.cpp index b2f48921..74691525 100644 --- a/src/datavisualization/doc/snippets/doc_src_q3dscatter_construction.cpp +++ b/src/datavisualization/doc/snippets/doc_src_q3dscatter_construction.cpp @@ -30,7 +30,7 @@ int main(int argc, char **argv) //! [0] //! [1] QScatterDataArray data; - data << QVector3D(1.0f, 0.5f, 1.0f) << QVector3D(-1.0f, -0.5f, -1.0f) << QVector3D(0.5f, 0.0f, 0.0f); + data << QVector3D(0.5f, 0.5f, 0.5f) << QVector3D(-0.3f, -0.5f, -0.4f) << QVector3D(0.0f, -0.3f, 0.2f); scatter->activeDataProxy()->addItems(data); //! [1] //! [2] diff --git a/src/datavisualization/doc/snippets/doc_src_q3dsurface_construction.cpp b/src/datavisualization/doc/snippets/doc_src_q3dsurface_construction.cpp index 33b6cf37..67587efc 100644 --- a/src/datavisualization/doc/snippets/doc_src_q3dsurface_construction.cpp +++ b/src/datavisualization/doc/snippets/doc_src_q3dsurface_construction.cpp @@ -30,12 +30,14 @@ int main(int argc, char **argv) //! [0] //! [1] QSurfaceDataArray *data = new QSurfaceDataArray; - QSurfaceDataRow *dataRow = new QSurfaceDataRow; + QSurfaceDataRow *dataRow1 = new QSurfaceDataRow; + QSurfaceDataRow *dataRow2 = new QSurfaceDataRow; //! [1] //! [2] - *dataRow << 0.1 << 1.8 << 0.4; - *data << dataRow; + *dataRow1 << QVector3D(0.0f, 0.1f, 0.5f) << QVector3D(1.0f, 0.5f, 0.5f); + *dataRow2 << QVector3D(0.0f, 1.8f, 1.0f) << QVector3D(1.0f, 1.2f, 1.0f); + *data << dataRow1 << dataRow2; //! [2] //! [3] diff --git a/src/datavisualization/doc/src/qtdatavisualization.qdoc b/src/datavisualization/doc/src/qtdatavisualization.qdoc index 45087e9d..191c7ba8 100644 --- a/src/datavisualization/doc/src/qtdatavisualization.qdoc +++ b/src/datavisualization/doc/src/qtdatavisualization.qdoc @@ -21,7 +21,9 @@ \title Qt Data Visualization C++ Classes \ingroup modules - \brief The QtDataVisualization module provides functionality for 3D visualization. + \brief C++ classes for the Qt Data Visualization API. + + Qt Data Visualization functionality can be accessed via these C++ classes. */ /*! @@ -36,19 +38,81 @@ */ /*! + \group datavisualization_examples + \title Qt Data Visualization Examples + + \brief Examples for the Qt Data Visualization. + + For some code examples, see one of the Qt Data Visualization examples: + + \section1 Examples + + \annotatedlist qtdatavisualization_examples +*/ + +/*! \page qtdatavisualization_getting_started.html \title Qt Data Visualization Getting Started \section1 Building Qt Data Visualization To build Qt Data Visualization module, set up a command prompt with an environment for - building Qt applications, navigate to the directory containing \c qtdatavisualization.pro, - and give the following commands: - - \snippet doc_src_qtdatavisualization.cpp 6 - - \note The \c make tool name may vary depending on your target platform. - E.g. make/nmake/mingw32-make/... + building Qt applications, navigate to the directory containing \c qtdatavisualization.pro, and + configure the project with qmake: + \code + qmake + \endcode + + After running qmake, build the project with make: + \table + \header + \li OS \li Make command + \row + \li Linux \li make + \row + \li Windows (MinGw) \li mingw32-make + \row + \li Windows (MSVC) \li nmake + \row + \li OSX \li make + \endtable + + The above generates the default makefiles for your configuration, which is typically + the release build if you are using precompiled binary Qt distribution. To build both debug + and release, or one specifically, use one of the following qmake lines instead. + + For debug builds: + \code + qmake CONFIG+=debug; make + \endcode + or + \code + qmake CONFIG+=debug_and_release; make debug + \endcode + + For release builds: + \code + qmake CONFIG+=release ; make + \endcode + or + \code + qmake CONFIG+=debug_and_release; make release + \endcode + + For both builds + \code + qmake CONFIG+="debug_and_release build_all"; make + \endcode + + If you want to install the module to your Qt directory use: + \code + make install + \endcode + + If you want to uninstall the module + \code + make uninstall + \endcode To build a statically linked version of the Qt Data Visualization module, give the following commands: diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp index cbe0446c..7863cda3 100644 --- a/src/datavisualization/engine/bars3drenderer.cpp +++ b/src/datavisualization/engine/bars3drenderer.cpp @@ -1491,18 +1491,7 @@ void Bars3DRenderer::handleResize() if (m_cachedBoundingRect.width() == 0 || m_cachedBoundingRect.height() == 0) return; - // Set view port - if (m_cachedIsSlicingActivated) { - m_mainViewPort = QRect(0, - m_cachedBoundingRect.height() - - (m_cachedBoundingRect.height() / smallerVPSize), - m_cachedBoundingRect.width() / smallerVPSize, - m_cachedBoundingRect.height() / smallerVPSize); - m_sliceViewPort = QRect(0, 0, m_cachedBoundingRect.width(), m_cachedBoundingRect.height()); - } else { - m_mainViewPort = QRect(0, 0, m_cachedBoundingRect.width(), m_cachedBoundingRect.height()); - m_sliceViewPort = QRect(0, 0, 0, 0); - } + setViewPorts(); Abstract3DRenderer::handleResize(); } @@ -1740,7 +1729,21 @@ void Bars3DRenderer::updateSlicingActive(bool isSlicing) return; m_cachedIsSlicingActivated = isSlicing; - if (isSlicing) { + + setViewPorts(); + + if (!m_cachedIsSlicingActivated) + initSelectionBuffer(); // We need to re-init selection buffer in case there has been a resize + +#if !defined(QT_OPENGL_ES_2) + updateDepthBuffer(); // Re-init depth buffer as well +#endif +} + +void Bars3DRenderer::setViewPorts() +{ + // Update view ports + if (m_cachedIsSlicingActivated) { m_mainViewPort = QRect(0, m_cachedBoundingRect.height() - (m_cachedBoundingRect.height() / smallerVPSize), @@ -1750,11 +1753,7 @@ void Bars3DRenderer::updateSlicingActive(bool isSlicing) } else { m_mainViewPort = QRect(0, 0, m_cachedBoundingRect.width(), m_cachedBoundingRect.height()); m_sliceViewPort = QRect(0, 0, 0, 0); - initSelectionBuffer(); // We need to re-init selection buffer in case there has been a resize } -#if !defined(QT_OPENGL_ES_2) - updateDepthBuffer(); // Re-init depth buffer as well -#endif } QRect Bars3DRenderer::mainViewPort() diff --git a/src/datavisualization/engine/bars3drenderer_p.h b/src/datavisualization/engine/bars3drenderer_p.h index 9b612474..764942cc 100644 --- a/src/datavisualization/engine/bars3drenderer_p.h +++ b/src/datavisualization/engine/bars3drenderer_p.h @@ -144,6 +144,7 @@ private: void drawScene(GLuint defaultFboHandle); void handleResize(); + void setViewPorts(); void loadBackgroundMesh(); void loadGridLineMesh(); void loadLabelMesh(); diff --git a/src/datavisualization/engine/q3dbars.cpp b/src/datavisualization/engine/q3dbars.cpp index 0a543d54..b40aeddd 100644 --- a/src/datavisualization/engine/q3dbars.cpp +++ b/src/datavisualization/engine/q3dbars.cpp @@ -260,7 +260,7 @@ void Q3DBars::setBarType(QDataVis::MeshStyle style, bool smooth) * * \sa setBarColor() * - * \warning This method is subject to change. + * \preliminary */ void Q3DBars::setTheme(QDataVis::Theme theme) { @@ -276,7 +276,7 @@ void Q3DBars::setTheme(QDataVis::Theme theme) * * \sa setTheme() * - * \warning This method is subject to change. + * \preliminary */ void Q3DBars::setBarColor(const QColor &baseColor, bool uniform) { diff --git a/src/datavisualization/engine/q3dscatter.cpp b/src/datavisualization/engine/q3dscatter.cpp index a5053bf3..3ad2cf2a 100644 --- a/src/datavisualization/engine/q3dscatter.cpp +++ b/src/datavisualization/engine/q3dscatter.cpp @@ -195,7 +195,7 @@ void Q3DScatter::setObjectType(QDataVis::MeshStyle style, bool smooth) * * \sa setObjectColor() * - * \warning This method is subject to change. + * \preliminary */ void Q3DScatter::setTheme(QDataVis::Theme theme) { @@ -211,7 +211,7 @@ void Q3DScatter::setTheme(QDataVis::Theme theme) * * \sa setTheme() * - * \warning This method is subject to change. + * \preliminary */ void Q3DScatter::setObjectColor(const QColor &baseColor, bool uniform) { diff --git a/src/datavisualization/engine/q3dsurface.cpp b/src/datavisualization/engine/q3dsurface.cpp index 7990f362..2a6506e1 100644 --- a/src/datavisualization/engine/q3dsurface.cpp +++ b/src/datavisualization/engine/q3dsurface.cpp @@ -66,7 +66,7 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE * * \snippet doc_src_q3dsurface_construction.cpp 1 * - * First feed the data to the row element and then add it's pointer to the data element: + * First feed the data to the row elements and then add their pointers to the data element: * * \snippet doc_src_q3dsurface_construction.cpp 2 * @@ -207,7 +207,7 @@ bool Q3DSurface::isBackgroundVisible() const * default. Theme affects label colors, text color, background color, window color and * grid color. Lighting is also adjusted by themes. * - * \warning This property is subject to change. + * \preliminary */ void Q3DSurface::setTheme(QDataVis::Theme theme) { diff --git a/src/datavisualization/engine/scatter3drenderer.cpp b/src/datavisualization/engine/scatter3drenderer.cpp index a482cc42..d2f983f1 100644 --- a/src/datavisualization/engine/scatter3drenderer.cpp +++ b/src/datavisualization/engine/scatter3drenderer.cpp @@ -472,6 +472,11 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle) // Bind dot shader m_dotShader->bind(); + // Set unchanging shader bindings + m_dotShader->setUniformValue(m_dotShader->lightP(), lightPos); + m_dotShader->setUniformValue(m_dotShader->view(), viewMatrix); + m_dotShader->setUniformValue(m_dotShader->ambientS(), m_cachedTheme.m_ambientStrength); + // Enable texture glEnable(GL_TEXTURE_2D); @@ -546,14 +551,11 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle) } // Set shader bindings - m_dotShader->setUniformValue(m_dotShader->lightP(), lightPos); - m_dotShader->setUniformValue(m_dotShader->view(), viewMatrix); m_dotShader->setUniformValue(m_dotShader->model(), modelMatrix); m_dotShader->setUniformValue(m_dotShader->nModel(), itModelMatrix.inverted().transposed()); m_dotShader->setUniformValue(m_dotShader->MVP(), MVPMatrix); m_dotShader->setUniformValue(m_dotShader->color(), dotColor); - m_dotShader->setUniformValue(m_dotShader->ambientS(), m_cachedTheme.m_ambientStrength); #if !defined(QT_OPENGL_ES_2) if (m_cachedShadowQuality > QDataVis::ShadowQualityNone) { diff --git a/src/datavisualization/engine/selectionpointer.cpp b/src/datavisualization/engine/selectionpointer.cpp index 6c3e0c8b..4fa9f688 100644 --- a/src/datavisualization/engine/selectionpointer.cpp +++ b/src/datavisualization/engine/selectionpointer.cpp @@ -245,12 +245,12 @@ void SelectionPointer::initShaders() // The shader for the small point ball if (m_pointShader) delete m_pointShader; -#if defined (Q_OS_ANDROID) - m_pointShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertexES2"), - QStringLiteral(":/shaders/fragmentES2")); -#else +#if !defined(QT_OPENGL_ES_2) m_pointShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertex"), QStringLiteral(":/shaders/fragment")); +#else + m_pointShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertexES2"), + QStringLiteral(":/shaders/fragmentES2")); #endif m_pointShader->initialize(); diff --git a/src/datavisualization/engine/surface3dcontroller.cpp b/src/datavisualization/engine/surface3dcontroller.cpp index 2272b731..c8823eb7 100644 --- a/src/datavisualization/engine/surface3dcontroller.cpp +++ b/src/datavisualization/engine/surface3dcontroller.cpp @@ -79,8 +79,11 @@ void Surface3DController::synchDataToRenderer() } if (m_changeTracker.smoothStatusChanged) { + bool oldSmoothStatus = m_isSmoothSurfaceEnabled; m_isSmoothSurfaceEnabled = m_renderer->updateSmoothStatus(m_isSmoothSurfaceEnabled); m_changeTracker.smoothStatusChanged = false; + if (oldSmoothStatus != m_isSmoothSurfaceEnabled) + emit smoothSurfaceEnabledChanged(m_isSmoothSurfaceEnabled); } if (m_changeTracker.surfaceGridChanged) { @@ -110,9 +113,13 @@ void Surface3DController::handleAxisRangeChangedBySender(QObject *sender) void Surface3DController::setSmoothSurface(bool enable) { + bool changed = m_isSmoothSurfaceEnabled != enable; m_isSmoothSurfaceEnabled = enable; m_changeTracker.smoothStatusChanged = true; emitNeedRender(); + + if (changed) + emit smoothSurfaceEnabledChanged(m_isSmoothSurfaceEnabled); } bool Surface3DController::smoothSurface() diff --git a/src/datavisualization/engine/surface3dcontroller_p.h b/src/datavisualization/engine/surface3dcontroller_p.h index 0efece97..0698c291 100644 --- a/src/datavisualization/engine/surface3dcontroller_p.h +++ b/src/datavisualization/engine/surface3dcontroller_p.h @@ -93,9 +93,7 @@ public slots: void handleArrayReset(); signals: - void smoothStatusChanged(bool enable); - void surfaceGridChanged(bool enable); - void segmentCountChanged(GLint segmentCount, GLfloat step, GLfloat minimum); + void smoothSurfaceEnabledChanged(bool enable); private: void adjustValueAxisRange(); diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp index a1dfc7e8..b73332f3 100644 --- a/src/datavisualization/engine/surface3drenderer.cpp +++ b/src/datavisualization/engine/surface3drenderer.cpp @@ -114,7 +114,6 @@ Surface3DRenderer::Surface3DRenderer(Surface3DController *controller) m_selectionModeChanged(false), m_hasHeightAdjustmentChanged(true) { -#if !defined(QT_OPENGL_ES_2) // Check if flat feature is supported ShaderHelper tester(this, QStringLiteral(":/shaders/vertexSurfaceFlat"), QStringLiteral(":/shaders/fragmentSurfaceFlat")); @@ -122,7 +121,6 @@ Surface3DRenderer::Surface3DRenderer(Surface3DController *controller) m_flatSupported = false; m_controller->setSmoothSurface(true); } -#endif m_cachedSmoothSurface = m_controller->smoothSurface(); updateSurfaceGridStatus(m_controller->surfaceGrid()); @@ -534,7 +532,8 @@ void Surface3DRenderer::drawSlicedScene() surfaceShader->setUniformValue(surfaceShader->lightP(), lightPos); surfaceShader->setUniformValue(surfaceShader->view(), viewMatrix); surfaceShader->setUniformValue(surfaceShader->model(), modelMatrix); - surfaceShader->setUniformValue(surfaceShader->nModel(), itModelMatrix.inverted().transposed()); + surfaceShader->setUniformValue(surfaceShader->nModel(), + itModelMatrix.inverted().transposed()); surfaceShader->setUniformValue(surfaceShader->MVP(), MVPMatrix); surfaceShader->setUniformValue(surfaceShader->color(), color); surfaceShader->setUniformValue(surfaceShader->lightS(), 0.25f); @@ -571,17 +570,17 @@ void Surface3DRenderer::drawSlicedScene() // Bind line shader lineShader->bind(); + // Set unchanging shader bindings + QVector3D lineColor = Utils::vectorFromColor(m_cachedTheme.m_gridLine); + lineShader->setUniformValue(lineShader->lightP(), lightPos); + lineShader->setUniformValue(lineShader->view(), viewMatrix); + lineShader->setUniformValue(lineShader->color(), lineColor); + lineShader->setUniformValue(lineShader->ambientS(), m_cachedTheme.m_ambientStrength * 2.0f); + lineShader->setUniformValue(lineShader->lightS(), 0.25f); + if (m_axisCacheY.segmentCount() > 0) { QVector3D gridLineScaleX(scaleXBackground, gridLineWidth, gridLineWidth); - // Set unchanging shader bindings - QVector3D lineColor = Utils::vectorFromColor(m_cachedTheme.m_gridLine); - lineShader->setUniformValue(lineShader->lightP(), lightPos); - lineShader->setUniformValue(lineShader->view(), viewMatrix); - lineShader->setUniformValue(lineShader->color(), lineColor); - lineShader->setUniformValue(lineShader->ambientS(), m_cachedTheme.m_ambientStrength * 2.0f); - lineShader->setUniformValue(lineShader->lightS(), 0.25f); - // Back wall GLfloat lineStep = 2.0f * m_axisCacheY.subSegmentStep() / m_heightNormalizer; GLfloat linePos = -1.0f; @@ -814,13 +813,13 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle) QMatrix4x4 depthProjectionMatrix; QMatrix4x4 depthProjectionViewMatrix; - GLfloat adjustedLightStrength = m_cachedTheme.m_lightStrength / 10.0f; QVector3D surfaceScaler(m_surfaceScaleX, 1.0f, m_surfaceScaleZ); QVector3D surfaceOffset(m_surfaceOffsetX, 0.0f, m_surfaceOffsetZ + zComp); // Draw depth buffer #if !defined(QT_OPENGL_ES_2) + GLfloat adjustedLightStrength = m_cachedTheme.m_lightStrength / 10.0f; if (m_cachedShadowQuality > QDataVis::ShadowQualityNone && m_surfaceObj) { // Render scene into a depth texture for using with shadow mapping // Enable drawing to depth framebuffer @@ -831,7 +830,7 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle) m_depthShader->bind(); // Set viewport for depth map rendering. Must match texture size. Larger values give smoother shadows. - glViewport(m_mainViewPort.x(), m_mainViewPort.y(), + glViewport(0, 0, m_mainViewPort.width() * m_shadowQualityMultiplier, m_mainViewPort.height() * m_shadowQualityMultiplier); @@ -965,10 +964,10 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle) m_selectionShader->release(); // Put the RGBA value back to uint -#if defined (Q_OS_ANDROID) - selectionId = pixel[0] + pixel[1] * 256 + pixel[2] * 65536; -#else +#if !defined(QT_OPENGL_ES_2) selectionId = pixel[0] + pixel[1] * 256 + pixel[2] * 65536 + pixel[3] * 16777216; +#else + selectionId = pixel[0] + pixel[1] * 256 + pixel[2] * 65536; #endif selectionDirty = true; @@ -1877,23 +1876,7 @@ void Surface3DRenderer::handleResize() if (m_cachedBoundingRect.width() == 0 || m_cachedBoundingRect.height() == 0) return; - // Set view port - if (m_cachedIsSlicingActivated) { - m_mainViewPort = QRect(0, - m_cachedBoundingRect.height() - m_cachedBoundingRect.height() / subViewDivider, - m_cachedBoundingRect.width() / subViewDivider, - m_cachedBoundingRect.height() / subViewDivider); - } else { - m_mainViewPort = QRect(0, 0, m_cachedBoundingRect.width(), m_cachedBoundingRect.height()); - } - m_sliceViewPort = QRect(0, 0, m_cachedBoundingRect.width(), m_cachedBoundingRect.height()); - - if (m_selectionPointer) { - if (m_cachedIsSlicingActivated) - m_selectionPointer->updateBoundingRect(m_sliceViewPort); - else - m_selectionPointer->updateBoundingRect(m_mainViewPort); - } + setViewPorts(); Abstract3DRenderer::handleResize(); } @@ -1983,7 +1966,8 @@ QString Surface3DRenderer::createSelectionLabel(qreal value, int column, int row void Surface3DRenderer::loadMeshFile() { - qDebug() << __FUNCTION__ << "should we do something"; + // Do nothing, not yet supported by this renderer + // TODO: To be used for overriding the selection ball mesh after technology preview } void Surface3DRenderer::updateShadowQuality(QDataVis::ShadowQuality quality) @@ -2028,24 +2012,38 @@ void Surface3DRenderer::updateShadowQuality(QDataVis::ShadowQuality quality) void Surface3DRenderer::updateSlicingActive(bool isSlicing) { - if (isSlicing == m_cachedIsSlicingActivated) + if (m_cachedIsSlicingActivated == isSlicing) return; m_cachedIsSlicingActivated = isSlicing; - if (isSlicing) { - m_mainViewPort = QRect(0, m_cachedBoundingRect.height() - m_cachedBoundingRect.height() / subViewDivider, - m_cachedBoundingRect.width() / subViewDivider, m_cachedBoundingRect.height() / subViewDivider); - if (m_depthTexture) { - m_textureHelper->deleteTexture(&m_depthTexture); - m_depthTexture = 0; - } - } else { - m_mainViewPort = QRect(0, 0, this->m_cachedBoundingRect.width(), - this->m_cachedBoundingRect.height()); + + setViewPorts(); + + if (!m_cachedIsSlicingActivated) initSelectionBuffer(); // We need to re-init selection buffer in case there has been a resize + #if !defined(QT_OPENGL_ES_2) - updateDepthBuffer(); // Re-init depth buffer as well + updateDepthBuffer(); // Re-init depth buffer as well #endif +} + +void Surface3DRenderer::setViewPorts() +{ + // Update view ports + if (m_cachedIsSlicingActivated) { + m_mainViewPort = QRect(0, + m_cachedBoundingRect.height() + - (m_cachedBoundingRect.height() / subViewDivider), + m_cachedBoundingRect.width() / subViewDivider, + m_cachedBoundingRect.height() / subViewDivider); + m_sliceViewPort = QRect(0, 0, m_cachedBoundingRect.width(), m_cachedBoundingRect.height()); + if (m_selectionPointer) + m_selectionPointer->updateBoundingRect(m_sliceViewPort); + } else { + m_mainViewPort = QRect(0, 0, m_cachedBoundingRect.width(), m_cachedBoundingRect.height()); + m_sliceViewPort = QRect(0, 0, 0, 0); + if (m_selectionPointer) + m_selectionPointer->updateBoundingRect(m_mainViewPort); } } diff --git a/src/datavisualization/engine/surface3drenderer_p.h b/src/datavisualization/engine/surface3drenderer_p.h index e42e820a..c805e508 100644 --- a/src/datavisualization/engine/surface3drenderer_p.h +++ b/src/datavisualization/engine/surface3drenderer_p.h @@ -149,6 +149,7 @@ public slots: void updateSelectionMode(QDataVis::SelectionMode mode); private: + void setViewPorts(); void updateSliceDataModel(int selectionId); virtual void updateShadowQuality(QDataVis::ShadowQuality quality); virtual void updateTextures(); diff --git a/src/datavisualization/global/qtdatavisualizationenums.qdoc b/src/datavisualization/global/qtdatavisualizationenums.qdoc index fde6a258..57e7d13d 100644 --- a/src/datavisualization/global/qtdatavisualizationenums.qdoc +++ b/src/datavisualization/global/qtdatavisualizationenums.qdoc @@ -20,6 +20,11 @@ \namespace QtDataVisualization \inmodule QtDataVisualization \target QtDataVisualization Enums + + QtDataVisualization namespace holds all the classes and enumerations in the QtDataVisualization + module. + + \generatelist{classesbymodule QtDataVisualization} */ /*! diff --git a/src/datavisualizationqml2/declarativesurface.cpp b/src/datavisualizationqml2/declarativesurface.cpp index 8375fa53..af3e059b 100644 --- a/src/datavisualizationqml2/declarativesurface.cpp +++ b/src/datavisualizationqml2/declarativesurface.cpp @@ -41,6 +41,9 @@ DeclarativeSurface::DeclarativeSurface(QQuickItem *parent) m_shared = new Surface3DController(boundingRect().toRect()); setSharedController(m_shared); + QObject::connect(m_shared, &Surface3DController::smoothSurfaceEnabledChanged, this, + &DeclarativeSurface::smoothSurfaceEnabledChanged); + QItemModelSurfaceDataProxy *proxy = new QItemModelSurfaceDataProxy; m_shared->setActiveDataProxy(proxy); } diff --git a/src/datavisualizationqml2/declarativesurface_p.h b/src/datavisualizationqml2/declarativesurface_p.h index 6ba52146..6e35b3b3 100644 --- a/src/datavisualizationqml2/declarativesurface_p.h +++ b/src/datavisualizationqml2/declarativesurface_p.h @@ -51,7 +51,7 @@ class DeclarativeSurface : public AbstractDeclarative Q_PROPERTY(Q3DValueAxis *axisX READ axisX WRITE setAxisX) Q_PROPERTY(Q3DValueAxis *axisY READ axisY WRITE setAxisY) Q_PROPERTY(Q3DValueAxis *axisZ READ axisZ WRITE setAxisZ) - Q_PROPERTY(bool smoothSurfaceEnabled READ isSmoothSurfaceEnabled WRITE setSmoothSurfaceEnabled) + Q_PROPERTY(bool smoothSurfaceEnabled READ isSmoothSurfaceEnabled WRITE setSmoothSurfaceEnabled NOTIFY smoothSurfaceEnabledChanged) Q_PROPERTY(bool surfaceGridEnabled READ isSurfaceGridEnabled WRITE setSurfaceGridEnabled) Q_PROPERTY(ColorGradient *gradient READ gradient WRITE setGradient) @@ -78,6 +78,9 @@ public: void setGradient(ColorGradient *gradient); ColorGradient *gradient() const; +signals: + void smoothSurfaceEnabledChanged(bool enabled); + protected: void handleGradientUpdate(); diff --git a/tests/barstest/main.cpp b/tests/barstest/main.cpp index 850561a7..7742cb0e 100644 --- a/tests/barstest/main.cpp +++ b/tests/barstest/main.cpp @@ -298,7 +298,7 @@ int main(int argc, char **argv) &GraphModifier::changePresetCamera); QObject::connect(themeButton, &QPushButton::clicked, modifier, &GraphModifier::changeTheme); QObject::connect(labelButton, &QPushButton::clicked, modifier, - &GraphModifier::changeStyle); + &GraphModifier::changeLabelStyle); QObject::connect(addDataButton, &QPushButton::clicked, modifier, &GraphModifier::addRow); QObject::connect(addMultiDataButton, &QPushButton::clicked, modifier, &GraphModifier::addRows); QObject::connect(insertDataButton, &QPushButton::clicked, modifier, &GraphModifier::insertRow); diff --git a/tests/scattertest/main.cpp b/tests/scattertest/main.cpp index 35ba228d..dda4536b 100644 --- a/tests/scattertest/main.cpp +++ b/tests/scattertest/main.cpp @@ -184,7 +184,7 @@ int main(int argc, char **argv) QObject::connect(themeButton, &QPushButton::clicked, modifier, &ScatterDataModifier::changeTheme); QObject::connect(labelButton, &QPushButton::clicked, modifier, - &ScatterDataModifier::changeStyle); + &ScatterDataModifier::changeLabelStyle); QObject::connect(shadowQuality, SIGNAL(currentIndexChanged(int)), modifier, SLOT(changeShadowQuality(int))); diff --git a/tools/generate_package_linux.sh b/tools/generate_package_linux.sh new file mode 100755 index 00000000..6a596d35 --- /dev/null +++ b/tools/generate_package_linux.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +DATAVIS_TEMP_DIR=temp_dir +DATAVIS_TEMP_DIR_FULL=../$DATAVIS_TEMP_DIR + +if [ "$1" = "" ] +then + echo Usage: $0 version [branch or SHA] + echo Branch defaults to master. + echo Creates the package in parent dir. + echo A temporary dir $DATAVIS_TEMP_DIR_FULL is utilized for intermediate steps. +fi + +if [ "$2" = "" ] +then + DATAVIS_BRANCH=master +else + DATAVIS_BRANCH=$2 +fi + +DATAVIS_VERSION=$1 +DATAVIS_CURRENT_DIR=$PWD +DATAVIS_BUILD_DIR=$DATAVIS_TEMP_DIR_FULL/tempbuild +DATAVIS_PACKAGE_UNTAR_NAME=qtdatavisualization_$DATAVIS_VERSION +DATAVIS_PACKAGE_UNTAR_DIR=$DATAVIS_TEMP_DIR_FULL/$DATAVIS_PACKAGE_UNTAR_NAME +DATAVIS_TEMP_TAR=qtdatavisualization_temp_$DATAVIS_VERSION.tar +DATAVIS_TEMP_TAR_FULL=$DATAVIS_TEMP_DIR_FULL/$DATAVIS_TEMP_TAR +DATAVIS_FINAL_TAR=$DATAVIS_CURRENT_DIR/../qtdatavisualization_$DATAVIS_VERSION.tar + +echo Exporting $DATAVIS_BRANCH to $DATAVIS_TEMP_TAR_FULL... +rm -r -f $DATAVIS_TEMP_DIR_FULL 2> /dev/null +mkdir -p $DATAVIS_TEMP_DIR_FULL 2> /dev/null +git archive --format tar --output $DATAVIS_TEMP_TAR_FULL $DATAVIS_BRANCH + +echo Unpacking $DATAVIS_TEMP_TAR_FULL to $DATAVIS_PACKAGE_UNTAR_DIR and $DATAVIS_BUILD_DIR... +mkdir -p $DATAVIS_PACKAGE_UNTAR_DIR 2> /dev/null +mkdir -p $DATAVIS_BUILD_DIR 2> /dev/null +tar -xvf $DATAVIS_TEMP_TAR_FULL -C $DATAVIS_PACKAGE_UNTAR_DIR > /dev/null +tar -xvf $DATAVIS_TEMP_TAR_FULL -C $DATAVIS_BUILD_DIR > /dev/null + +echo Generating includes, mkspecs, and docs in $DATAVIS_BUILD_DIR... +cd $DATAVIS_BUILD_DIR +mkdir -p .git 2> /dev/null +qmake > /dev/null 2> /dev/null +make docs > /dev/null 2> /dev/null +cd $DATAVIS_CURRENT_DIR + +echo Copying generated files to $DATAVIS_PACKAGE_UNTAR_DIR +cp -r $DATAVIS_BUILD_DIR/doc $DATAVIS_PACKAGE_UNTAR_DIR/doc +cp -r $DATAVIS_BUILD_DIR/include $DATAVIS_PACKAGE_UNTAR_DIR/include + +echo Repackaging $DATAVIS_PACKAGE_UNTAR_DIR to $DATAVIS_FINAL_TAR +rm $DATAVIS_FINAL_TAR 2> /dev/null +cd $DATAVIS_TEMP_DIR_FULL +tar -cvf $DATAVIS_FINAL_TAR $DATAVIS_PACKAGE_UNTAR_NAME >/dev/null +gzip $DATAVIS_FINAL_TAR >/dev/null +cd $DATAVIS_CURRENT_DIR + +exit 0 diff --git a/tools/generate_package_win.cmd b/tools/generate_package_win.cmd new file mode 100644 index 00000000..2a1895b7 --- /dev/null +++ b/tools/generate_package_win.cmd @@ -0,0 +1,57 @@ +@echo off + +SETLOCAL + +set DATAVIS_TEMP_DIR=temp_dir +set DATAVIS_TEMP_DIR_FULL=..\%DATAVIS_TEMP_DIR% + +if "%1"=="" ( + echo Usage: generate_package_win version [branch or SHA] + echo Branch defaults to master. + echo Creates the package in parent dir. + echo A temporary dir %DATAVIS_TEMP_DIR_FULL% is utilized for intermediate steps. + goto :end +) + +if "%2"=="" ( + set DATAVIS_BRANCH=master +) else ( + set DATAVIS_BRANCH=%2 +) + +set DATAVIS_VERSION=%1 +set DATAVIS_BUILD_DIR=%DATAVIS_TEMP_DIR_FULL%\tempbuild +set DATAVIS_PACKAGE_UNZIP_DIR=%DATAVIS_TEMP_DIR_FULL%\qtdatavisualization_%DATAVIS_VERSION% +set DATAVIS_TEMP_ZIP=qtdatavisualization_temp_%DATAVIS_VERSION%.zip +set DATAVIS_TEMP_ZIP_FULL=%DATAVIS_TEMP_DIR_FULL%\%DATAVIS_TEMP_ZIP% +set DATAVIS_XCOPY_CMD=xcopy /s /i /q +set DATAVIS_FINAL_ZIP=..\qtdatavisualization_%DATAVIS_VERSION%.zip + +echo Exporting %DATAVIS_BRANCH% to %DATAVIS_TEMP_ZIP_FULL%... +rmdir /q /s %DATAVIS_TEMP_DIR_FULL% 2> NUL +md %DATAVIS_TEMP_DIR_FULL% 2> NUL +call git archive --format zip --output ../%DATAVIS_TEMP_DIR%/%DATAVIS_TEMP_ZIP% %DATAVIS_BRANCH% + +echo Unzipping %DATAVIS_TEMP_ZIP_FULL% to %DATAVIS_PACKAGE_UNZIP_DIR% and %DATAVIS_BUILD_DIR%... +md %DATAVIS_PACKAGE_UNZIP_DIR% 2> NUL +md %DATAVIS_BUILD_DIR% 2> NUL +call 7z x -y -o%DATAVIS_PACKAGE_UNZIP_DIR% %DATAVIS_TEMP_ZIP_FULL% > NUL +call 7z x -y -o%DATAVIS_BUILD_DIR% %DATAVIS_TEMP_ZIP_FULL% > NUL + +echo Generating includes, mkspecs, and docs in %DATAVIS_BUILD_DIR%... +pushd %DATAVIS_BUILD_DIR% +::Fake git build to get syncqt to run +md .git 2> NUL +qmake > NUL 2> NUL +nmake docs > NUL 2> NUL +popd + +echo Copying generated files to %DATAVIS_PACKAGE_UNZIP_DIR% +%DATAVIS_XCOPY_CMD% %DATAVIS_BUILD_DIR%\doc %DATAVIS_PACKAGE_UNZIP_DIR%\doc +%DATAVIS_XCOPY_CMD% %DATAVIS_BUILD_DIR%\include %DATAVIS_PACKAGE_UNZIP_DIR%\include + +echo Repackaging %DATAVIS_PACKAGE_UNZIP_DIR% to %DATAVIS_FINAL_ZIP% +del /q %DATAVIS_FINAL_ZIP% 2> NUL +call 7z a -r -y -tzip %DATAVIS_FINAL_ZIP% %DATAVIS_PACKAGE_UNZIP_DIR% >NUL + +:end |